Lifting expressions

John Nilsson john at milsson.nu
Fri Jan 29 16:34:45 PST 2010


Hi all,

I tried to raise this question in the earlier days of this mailing list.
Back then it didn't spark much discussion, so I'll try again now and hope
there is more interest now.

I think one of the most important aspects of lambdas is terseness, in the
sense of removing boiler plate from what should be domain logic.

To this end I think some syntactic sugar for lifting expressions/statements
of various kinds into lambdas is a good thing.

So the question is: do others on this list think this is something that
should be included in the final implementation?

Examples:

lifting a simple expression

#String(String,String) concatOp = (+", "+);


or directly as an argument to a method call

String wordList = "[" + words.reduce(+", "+) + "]";


Lifting a method

#void(Object) action = System.out.println;


Lifting a method invoked on the argument

#String(Object) mapper = (.toString());


Maybe one should also do as in Scala and designate a wildcard to support
lifting of more expression variants:

#String(String) wrapOp = "["+_+"]";



I'm sure there are lots of ambiguity and other problems with the examples
above. But I hope something reasonable can be designed if others agree that
it fits with the language.


BR,
John


More information about the lambda-dev mailing list