Effectively final effective?

Alex Blewitt alex.blewitt at gmail.com
Wed Feb 24 13:24:03 PST 2010


The Lambda 0.1.5 spec introduces 'effectively final', as a way of getting final-like variables but without having to type the letters f i n a l into the code. 

I'd argue that adding the keyword is no more or less difficult than it was when inner classes were introduced, and that modern IDEs will automatically prompt you to change the variable to final with a single click if used in an inner class. 

Furthermore, I've never found it difficult to add it in when needed; but it does encode (in the source) the fact that it's supposed to be final, which then discourages changing it elsewhere. An effectively final variable loses that information, which might lead to developers wondering why subsequent assignments don't work or cause compilation errors elsewhere.

My concern is that by introducing the 'effectively final' change in with the Lambda spec, we're increasing the scope of the change - and therefore the potential for issues. 

Lastly, it's not clear whether effectively final would also apply to inner classes, and whether this would be seen for a good or bad change given the above.

Alex


More information about the lambda-dev mailing list