Saturday, April 21, 2007
The Java Memory Model & Concurrency
I just watched the presentation Advanced Topics in Programming Languages: The Java Memory Model given by Jeremy Manson (Google Tech Talks March 21, 2007). Although I was familiar with most, I really enjoyed watching the complete video (I rarely do this for those longer than 15min). If didn't see it already:
Monday, April 02, 2007
Extended Type-Cast vs. Closures vs. Current Java
Although I'm not a fan of messing up the Java language, I had another idea, I'd like to share:
An extended type-cast for single-method interfaces, which succeeds if the signatures are compitable. More precise, the target's method could be overridden by the one of the source interface, the syntax could be:
(Note: contravariant arguments would be also possible)
I guess it's is highly related to the ongoing debate if and how to integrate closures (CICE, FCM and BGGA). Although, I think the last one has its pros and I really like the idea of first-class methods (place my vote here), the remaining one really has a mighty ally: simplicity.
However, the absense of method/functions type, which can be assigned only depending on their signature types, makes it look a bit clumsy. With the proposed extended type-cast, things would be more balanced as this example shows.
Just, for those who didn't have noticed yet, the main thing is
EDIT: Modified the source to match the BGGA proposal accoringly to Neal Gafter's comment.
An extended type-cast for single-method interfaces, which succeeds if the signatures are compitable. More precise, the target's method could be overridden by the one of the source interface, the syntax could be:
(A as B)
(Note: contravariant arguments would be also possible)
I guess it's is highly related to the ongoing debate if and how to integrate closures (CICE, FCM and BGGA). Although, I think the last one has its pros and I really like the idea of first-class methods (place my vote here), the remaining one really has a mighty ally: simplicity.
However, the absense of method/functions type, which can be assigned only depending on their signature types, makes it look a bit clumsy. With the proposed extended type-cast, things would be more balanced as this example shows.
Just, for those who didn't have noticed yet, the main thing is
(Bar as Foo)
, but it looks nicer within the other syntax sugar as well:- calling the single method of an interface, its name can be omitted
- simplifyedcreation of anonymous classes, which implement single-method interfaces
- usage of
var/final
instead of specifying the reference type
EDIT: Modified the source to match the BGGA proposal accoringly to Neal Gafter's comment.
Subscribe to:
Posts (Atom)