Closures, too much or too little?

tronicek at fit.cvut.cz tronicek at fit.cvut.cz
Mon Nov 23 04:51:12 PST 2009


Hi Howard,

I do not understand your arguments. Warning means "be cautious, there may
be an error" and error means "there is an error".
The @Shared annotation says "be cautious, the variable will be shared
between threads". This warning makes sense because we (programmers) are
not used to sharing the local variables.
However, it does not mean anything on the bytecode level. That is, the
program is compiled the same way regardless of the annotation. So what
error you want to report?

> I also find the advise that annotations don't change program behavior
> a little silly. Half the time your program won't even run without the
> correct annotations in many frameworks!

There is a difference between the Java language and Java frameworks. If
you let the annotations change the semantics of the Java language, what
would be the difference between annotations and keywords? None, except the
way how they are written. And does it make sense to have two language
categories for the same?
It may seem that annotations can help in adding new features. To some
extent, it is true. But it violates the language consistency.

Zdenek
-- 
Zdenek Tronicek
FIT CTU in Prague
http://kenai.com/projects/refactoringng - refactoring tool for compiler guys


Howard Lovatt napsal(a):
> Sure for BGGA it suppresses a warning, but there would be nothing to stop
> inner classes been changed to the same mechanism (I think CISE proposed
> something similar). For a library as opposed to a language feature you
> could
> change the @Shared to provide automatic wrapping in a holder. This is not
> quite the same, in that you would get an error as opposed to a warning if
> @Shared was absent.
>
> However, I prefer the error since I am not a fan of warning messages and
> thought Java was better before warnings and I am therefore not fazed by
> this. I also find the advise that annotations don't change program
> behavior
> a little silly. Half the time your program won't even run without the
> correct annotations in many frameworks!
>
>  -- Howard.
>
> 2009/11/22 Neal Gafter <neal at gafter.com>
>
>> On Sun, Nov 22, 2009 at 12:20 PM, Howard Lovatt
>> <howard.lovatt at iee.org>wrote:
>>
>>> I agree with your point that it really only captures finals (which as
>>> you
>>> say are simple values of an expression in the LamdaJ 'closure'), but to
>>> me
>>> this is a secondary issue. A @Shared annotation could be introduced
>>> that
>>> works with inner classes and with LamdaJ closures.
>>>
>>
>> @Shared in BGGA just suppresses a warning; it has no effect on the
>> semantics of the code.  I have no idea what specification for an
>> annotation
>> you have in mind that could affect the way lambdaj works.
>>
>> ______________________________________________________________________
>> This email has been scanned by the MessageLabs Email Security System.
>> For more information please visit http://www.messagelabs.com/email
>> ______________________________________________________________________
>>
>
>
>
> --
>  -- Howard.
>
>
>
> --
>  -- Howard.
>
>




More information about the coin-dev mailing list