On Tue, 2007-07-17 at 17:40 -0700, Raoul Duke wrote:
> hi,
> 
> Many thanks for all the info, it is good to get a handle on what is going on.
> 
> > There's little need for things like SWIG, because there
> > is no substantive (executable) glue logic. Adding two
> > integers in Felix is the same as in C:
> 
> While it is simple, it still seems like boilerplate.

Yes, it more or less is.

>  My hope is to
> take some 3rd party C++ library and then write Felix code to use it,
> so I can do the fun functional style. But I think that means I have to
> write a fair bit of stuff in Felix which is just saying what the
> library's files say. 

Yes. Although you can write the bindings incrementally,
as you need them.

> But I have to do that manually. Seems ripe for
> some kind of automatic translator. Maybe I can learn flxcc some day :)

Even with flxcc, you still have to edit the output.

For example, it is very hard to interpret macros -- they don't
come with type information. Some idiot C libraries use lots of macros.

Felix does provide sugar to help with some of these things ..
but if I gave you all the tips straight away it would be
rather daunting. For example:

cstruct GdkColor {
  pixel: uint32;
  red: uint16;
  green: uint16;
  blue: uint16;
};

wraps GDK color struct, no need to do:

        type GdkColor = "GdkColor";
        fun get_pixel: GdkColor -> uint32 = "$1.pixel";
        ...

although this is equivalent. There's a cclass for C++ classes
too. And you can write:

        ctypes int, long, fred, joe;

which just means

        type int = "int";
        type long = "long";
        ...

and you can write:

        fun f: int -> int;

which just means

        fun f: int -> int = "f($1)";

and

        const X: int;

which means:

        const X: int = "X";

So there are a number of short forms for common requirements.

One you mentioned before:

        chead "<stdio.h>";

meaning

        header "#include <stdio.h>";

is not implemented at the moment, but WOULD be another such
short form .. it's slightly tricky because of

        #include "fred.h"
        #include <fred.h>

i.e. the " and < style delimiters.

-- 
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to