I'm removing a lot of hackery from Felix at the moment. A few issues remain 
though: arrays and lvalues.

Lvalues are problematic. Originally,  the idea was only to support pointers, 
but it made
a lot of syntax untenable, eg: x++ so lvalues were introduced into the type 
system.
Now they're gone again (because they don't make any sense in a type system).
We're back to pointers. That leaves a need for taking the address of lvalues :)
Currently Felix can only take the address of whole variables. For Felix stuff 
that's close
to enough: a bit annoying you can't do &(x.y) but that could be handled by 
(&x)+y
(i.e. pointer arithmetic). C functions can return lvalues though, currently:

        lvalue fun f....

is supposed to work, allowing &(f()). Operations like ++x are translated to

        pre_incr (&x)


Arrays are also problematic. At present we have types

        &T // pointer
        ptr[T] // C pointer
        carray[T]  // C style array
        array[T,N]  // inline array
        varray[T]   // bounded size variable length array
        darray[T] // unbounded size variable length array

all of which are arrays (even &T is a pointer to T and can be passed
to C where an array is needed ...).

ptr[T] is an abstract C pointer, a nice idea, but in practice probably has to be
cast to &T so I'm planning to get rid of it (and friend cptr[T] which is a
T const pointer). Felix doesn't support "const" pointers so C functions have
to cast away const in return types, const in arguments doesn't matter.

carray[T] was intended to be used where an array was needed, rather than
using &T.. but again, its extra casts.

For pointers there's the issue of length of an array (how to do dependent 
typing?)
and NULL of course.

I'm not happy with any of this .. :) In some ways this is right:

        xarray[T,99+n]

i.e. an array with a fixed but dynamically determined length: we don't have a 
type
for that, it's a special case of varray.

All these array kinds and pointers have to work together without too many casts,
but we also want as much type and dynamic safety as possible.

Not clear how to do all this :)


--
john skaller
skal...@users.sourceforge.net





------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and, 
should the need arise, upgrade to a full multi-node Oracle RAC database 
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to