Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2004:
[Freeciv-Dev] Re: (PR#8239) Speclist generator
Home

[Freeciv-Dev] Re: (PR#8239) Speclist generator

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: per@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#8239) Speclist generator
From: "Raimar Falke" <i-freeciv-lists@xxxxxxxxxxxxx>
Date: Mon, 22 Mar 2004 22:45:34 -0800
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=8239 >

On Mon, Mar 22, 2004 at 11:32:10AM -0800, Jason Short wrote:
> 
> <URL: http://rt.freeciv.org/Ticket/Display.html?id=8239 >
> 
> Per I. Mathisen wrote:
> > To overcome some limitations in the specfile system, I've made a python
> > generator to create speclist header files. It is small and simple, and
> > from a lists.def file in each relevant directory, creates a named header
> > file which contains all the speclists listed in lists.def. They are
> > all inlined, so no .c file is needed.

I don't see that the specfiles are hard to use. With <10 lines you get
a type safe list. That is good.

> It's things like this that make it seem like we shouldn't be using C.
> 
> Maybe eventually all of Freeciv will be coded via python generators?

> Maybe this code would be better off coded directly in python and linked 
> to C?  (I'm not sure if this is possible because a lot of it is macros.)

Not really an option. Python for example isn't type safe.

Generators should be used if there is code which has a high
abstraction which the C-compiler doesn't understand. I think that
speclist problem doesn't have this abstraction value.

One example if a generator would be an inline-preprocessor. You have
normal C source code (in .c files) and than you specify a set of
function which should be inlined and another set which should be
macros. Than you let the generator run and it will produce new C
source code which the C-compiler sees. With this you can avoid the
macro/inline "problem". If the generator also does the dependency
resolving you have a real tool.

Another example would be gui code. However this exists already with
glade. And dynamically libglade and FS's theme-engine.

So I don't see much places were we can increase the abstraction by
using generators like we did with the packets generator.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 "Transported to a surreal landscape, a young girl kills the first woman
  she meets and then teams up with three complete strangers to kill again."
    -- TV listing for the Wizard of Oz in the Marin Independent Journal




[Prev in Thread] Current Thread [Next in Thread]