Re:Java 7: Oracle pushes a first version of closures
by euroclydon on Monday May 31, 2010 @12:08PM
(#1392803)
What's with the "#" sign? Is that new for lambdas, or an existing Java symbol?
[ Parent
| on HN ]
Re:Java 7: Oracle pushes a first version of closures
by svv on Monday May 31, 2010 @06:00PM
(#1393611)
This syntax is similiar to Stephen Colebourne's FCM proposal: http://docs.google.com/Doc?id=ddhp95vd_6hg3qhc
That proposal also used the "#" symbol, with the following rationale: "The symbol is already used within Javadoc to separate the class name from the method name in exactly this manner. The method literal syntax merely brings the Javadoc convention into Java source code."
It's a reasonable choice for full first-class methods; it doesn't fit quite as nicely if Oracle only introduces closures as a syntax sugar for anonymous classes.
But I think it's OK anyway -- it's concise and even looks a bit like clojure :-)
Re:Java 7: Oracle pushes a first version of closures
by ebiester on Monday May 31, 2010 @01:17PM
(#1392973)
That's new for lambdas.
Re:Java 7: Oracle pushes a first version of closures
by tlack on Monday May 31, 2010 @03:55PM
(#1393327)
Java isn't very "symboly" in practice. Any idea why they made such an unusual choice? I'm not against it (I prefer symbols to long words generally, even if they have a slightly longer learning curve), but it seems unlike the rest of the Java spec.
Re:Java 7: Oracle pushes a first version of closures
by RodgerTheGreat on Monday May 31, 2010 @04:28PM
(#1393407)
Well, the alternative is adding a new keyword, and it's difficult to do that without risking breaking any existing code that uses whatever identifier they choose. Breaking old code is even less "Java" than introducing new symbols.
edit: Actually, now that I think about it, this wouldn't be the first time they introduced a new keyword with a language update. So much for that argument:
http://java.sun.com/docs/books/tutorial/java/nutsandbolts/_k...