What should the development priorities for Felix be?

I have a huge list of things to do, including:

* library enhancements
* semantics upgrades

Semantics upgrades:

* fix addressing. At present, you can take the address of any expression
  except a "val". The idea is that you can only take the address of:

  (a) a C function marked "lvalue"
  (b) a var
  (c) a component of a var struct/tuple/record, recursively

In addition, addition to pointers should be fixed somehow: yet to
be designed how to do this!

* fix dot.operator

At present, structure/record/tuple component lookup is special, if that doesn't 
work,
then we try reverse application. This also fails if the function is n-ary, i.e. 
curried for
multiple arguments, and any ambiguity is not resolved on the first argument:

        fun f(x:int) (y:int) => ...
        fun f(x:in) (y:float)=>
        println$ f 1 2.0; // ok
        println$ 1.f 2.0; // fails

The idea is that 

        x.field

should be changed to 

        field x

by normal reverse application, and then the lookup work because x is a 
structure.
Also, if x is a pointer to a structure we want

        field (&x)

to return a pointer to the component. This is necessary so

        (&x).field <- 42;

works. Note also this means that

        x.2

will mean

        2 x // third component of x

Since &(x.field) isn't allowed by the previous addressing fix,
you can't write:

        x.field = 42;

unless we do something about it, so we can just define

        &(x.field) --> (&x).field

as a parser or early desugaring hack (recursively). Then we get

        field (&x)

as the interpretation. So in effect every struct defines two projections:

        field: X -> t
        field: &X -> &t

This means:

        2: A -> t // third component of tuple or array
        2: &A -> &t // pointer to third component

For an array:

        a.expr  --> (expr) a
        (&a).expr -> (expr) a

In particular note the second formula means pointer arithmetic!
Comes automatically! I.e.

        val n = 2;
        n 2 == n.2 == n.[2]
        *((&n) 2) == *((&n).2) == n.2

in particular:

        val p = (&n).2;
        val q = p + 1; // add 1 to pointer, same as C

This only works for array[T,N] in a variable.
It also isn't safe! Indexing varrays is safe.
We can make pointers into varrays safe too, with some
fierce hackery: the GC knows the head pointer and length.

* Make 

        inherit[U] X[U];

work. At present it goes into an infinite loop if I enable it

* Make class new work.
  The code for this is done, it just isn't type safe and there's no 
  syntax for it. Class constructs a new object on the heap based
  on a constructor, like C++, and, typically, delegated to C++.

  The existing "new" operator does not do this, it *clones*
  an object, i.e. uses the copy constructor.

  The problem is primarily syntax:

        new class X (1);

and also for the constructors:

        constructor X: int  = "X($1);

Note that "ctor" is NOT a type constructor, it's a value constructor,
that is, "ctor" are really factory functions or conversions, not 
constructors ;( Maybe I should rename them all (gasp!) cvrt:

        cvrt int: long = "(int)$1";
        cast int: long = (int)$1"; // Argghhh

--
john skaller
skal...@users.sourceforge.net
http://felix-lang.org




------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to