A couple of questions about Project Lambda
Marcus Thiesen
marcus at thiesen.org
Fri Aug 13 05:19:10 PDT 2010
Hi Lambda-Devs,
I toyed around a little bit with the latest Lambda prototype and got a
couple of questions. I used the mercurial version as of today against
jdk7 build 104 as described in [1].
SAM Conversion:
The spec in [2] says "A SAM (Single Abstract Method) type is a
top-level class or interface
type with abstract member". I misread this as "top-level class or
top-level interface", but the implementation actually works with
member interfaces [3] which strikes me as inconstistent because I can
use SAM conversion with a member interface but not with a member
class, is there any reason for this?
Function Types:
Trying to compile [4] does not work:
(master)->marcus at lindan:~/src/java7/lambda:
../../java/langtools/dist/bin/javac -source 7 -XDallowFunctionTypes
FunctionTypes.java
FunctionTypes.java:3: function types are not supported in -source 1.7
public String resolver( final String value, #String(String) function ) {
^
(use -source 7 or higher and -XDallowFunctionTypes to enable function types)
1 error
I guess this is due to my setup but is it supposed to work like this
or are the Function Types pure virtual types that I can not declare as
the type of a variable?
Defender Methods:
Running [5] gives me an AbtractMethodError but compiles, somehow he is
looking for an implementation of the actual method without the
interface extra argument.
Furthermore I would like to know if a Interface with only one single
not defender Method should actually qualify for SAM conversion,
apparently it does not work that way atm.
Any feedback would be welcome,
Marcus
1: http://mail.openjdk.java.net/pipermail/lambda-dev/2010-August/002179.html
2: http://mail.openjdk.java.net/pipermail/lambda-dev/attachments/20100122/3764c21a/attachment.txt
3: http://github.com/marcust/jdk7-examples/blob/master/lambda/SAM.java
4: http://github.com/marcust/jdk7-examples/blob/master/lambda/FunctionTypes.java
5: http://github.com/marcust/jdk7-examples/blob/master/lambda/DefenderMethods.java
--
:: Marcus Thiesen :: www.thiesen.org :: ICQ#108989768 :: 0x754675F2 ::
I've been to war. I've raised twins. If I had a choice, I'd rather go to war
George W. Bush
More information about the lambda-dev
mailing list