[Omake] test/object/Test14

Jason Hickey jyh at cs.caltech.edu
Fri Aug 3 10:30:32 PDT 2007


On Aug 2, 2007, at 3:52 PM, Aleksey Nogin wrote:

> Here is a simple hack for "shallow methods"

I like this idea.  I think it needs a little thought to move it from  
"cute trick" to "design principle".

We currently have two ways to build lazy values ($` and 0-arity  
functions), and I don't want a third.  So we need a unifying principle.

I think the most convincing argument to me would be for OMake to  
support partial application.  Either full partial application, or in  
the restricted form where only 0-arity functions are applied.  To be  
clear, by full partial application, I mean that both of the the  
following programs would be legal.

    # Application syntax
    - debug-add(x) =
         println($x)
         fun(y) =>
            println($y)
            add($x, $y)
      debug-add(1, 2)

    # Partial application
    - f(x, y) =
         add($x, $y)
      add1 = $(f 1)

In either case, 1) keyword arguments introduce a twist, and 2) I  
would say that all the functions along the path should be applied,  
not just the first one.

     X. =
         f() =
            println(called f1)
            fun() =>
               println(called f2)
               fun() =>
                  println(called f3)
                  fun(x) =>
                     println($x)
     X.f(1)

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