A syntax option (function types versus arrays)

Jakob Praher jp at hapra.at
Thu Mar 11 01:55:41 PST 2010


Alex Blewitt schrieb:
> On 11 Mar 2010, at 08:52, Jakob Praher wrote:
>
> OK, I'll point out the obvious. any 'some letters' are currently a valid identifier in Java, and you can't guarantee that there's no-one in the world who hasn't used the identifier 'lambda' before. So pretty much any construct needs to be either one of the unused keywords in the existing Java language spec (e.g. goto) or something that currently isn't semantically correct in an existing Java program as an identifier (hence the #).  That's not to say that necessarily # has to be the only other choice, but introducing a new keyword based on existing (potentially common) words is likely to cause issues.
>   
Sure that is clear. This was a sentiment to favor a readable letter 
(this is why I am still convinced that adding declaration-site variance 
would be best, since then you do not need any keyword at all), not a 
demand to carelessly introduce a new keyword.

If we use an identifier/keyword it MUST convey the right semantics.IMHO 
the type of a lambda is a function/callable. In computer science theory 
lambda is a concept for expressing computation, but in Java in its 
current form it is a synonym for anonymous function with variable 
capture from the enclosing lexical scope.

Remeber that a lambda is the project name: 
http://blogs.sun.com/mr/entry/closures_qa#comment-1259799344000

I do want to use methods as functions too without having to call them 
lambdas. Sure most of them end up capturing instances away, but in the 
formal parameters it should called a function or callable or invokable.

<T> void filter (Function1<Boolean, T> x);
<T> void filter (lambda<bool (T)> x);
<T> void filter (func<bool (T)> x);

In function based on the typed lambda calulus (e.g. Haskell) on also 
uses lambda expressions to create anonymous functions. The type of a 
lambda expression is a function.

See also FCM: http://docs.google.com/Doc?id=ddhp95vd_6hg3qhc

-- Jakob
>
>   



More information about the lambda-dev mailing list