[Omake] Merging

Jason Hickey jyh at cs.caltech.edu
Sat Apr 21 07:27:02 PDT 2007


Hi Aleksey,

The time is about right, and I'd like to start merging.  The jumbo  
branches can be divided into 3 parts:

    - everything before var3
    - var3
    - everything after

var3 is the one that does the naming.  What's before it is keyword  
arguments (and some code reorganization).

I think we should plan on merging through keyword arguments.   
Everything is committed to svn.

Keyword arguments also add generic function notation.

Here, f is passed an identity function.  f is not special, it is a  
variable.

    f(x) =>
        value $x
    f(x => $x)

Map with an anonymous function.

    foo.map(x => $(add $x, 1))

Functions with an indented body.

    f(x => a b c)
        echo $x

This notation is a bit misleading--the binder is bound over the  
indented body, not the rest of the argument list.  I've thought of  
other notations, but I'm not sure.

Old-style foreach and fun are supported for backwards-compatibility.   
They are rewritten during IR generation; it is a syntactic operation,  
so "foreach" and "fun" are basically like keywords in applications.

    foreach(x, a b c)
        echo $x
    fun(x, $x)
# is rewritten to
    foreach(x => a b c)
        echo $x
    fun(x => $x)

I'm away until Sunday, but I'd like to start this next week.

Jason

--
Jason Hickey                  http://www.cs.caltech.edu/~jyh
Caltech Computer Science      Tel: 626-395-6568 FAX: 626-792-4257





More information about the OMake-Devel mailing list