www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Java adds concurrency annotations

reply Paul D. Anderson <paul.d.removethis.anderson comcast.andthis.net> writes:
The folks at Sun are adding standard annotations to Java 7 for security,
concurrency, precondiitons and nullability, among others:

http://today.java.net/pub/a/today/2008/09/11/jsr-305-annotations.html

I wonder how these will play out in the real world. I'm especially interested
in the  Immutable annotation since Java's pass-by-reference implementation
makes immutability very difficult to implement.

Thanks again, Walter, for the transitive const paradigm. (Although I still
contend that you got the keyword wrong: it should be "immutable" -- just like
Java!!)

Paul
Sep 11 2008
parent reply Walter Bright <newshound1 digitalmars.com> writes:
Paul D. Anderson wrote:
 The folks at Sun are adding standard annotations to Java 7 for
 security, concurrency, precondiitons and nullability, among others:
 
 http://today.java.net/pub/a/today/2008/09/11/jsr-305-annotations.html
 
 
 I wonder how these will play out in the real world. I'm especially
 interested in the  Immutable annotation since Java's
 pass-by-reference implementation makes immutability very difficult to
 implement.
My reading of the article suggests that it is a compile time only thing. There's no mention of transitivity, but the description implies it isn't transitive.
 Thanks again, Walter, for the transitive const paradigm. (Although I
 still contend that you got the keyword wrong: it should be
 "immutable" -- just like Java!!)
 
 Paul
Sep 11 2008
parent Benji Smith <dlanguage benjismith.net> writes:
Walter Bright wrote:
 My reading of the article suggests that it is a compile time only thing. 
 There's no mention of transitivity, but the description implies it isn't 
 transitive.
It's not strictly compile-time. The annotations are retained as metadata in the bytecode, so they could be used at runtime, but the main point of retention is for static analysis of bytecodes. The Immutable annotation is definitely not transitive. Off the top fo my head, the idea of transitive const seems to rely on "ownership" of data. And since java deliberately eschews the idea of data ownership, I doubt if it would be possible to implement transitive const. Also, the Immutble annotation only applies to data, and there doesn't seem to be any annotation for ThisMethodDoesntModifyItsArgs. --benji
Sep 11 2008