Theres a patch pending acceptance on ticket:100 implementing readonly.
Its implemented as an accessmodifier ( named 'final') rather than a keyword
Java doesnt have (c# equiv) const - its final variables act like c# readonly, (static) final variables may be computed statically at compile time if possible
The promise cobra makes as to the meaning of const vs readonly/final ( if directly supporting both) is going to be a bit weaselly depending on the back end support for
the same concepts.
Hence I'd suggest promising direct support for runtime initted constants with the (weaker) promise of best effort for compile time support if supported by backend
(const keyword, combinatorial for weaker promise) worst case is that you only get readonly equivalent which is probably most desirable situation anyway.
I dont see val/value as being significantly better than const for indicating some form of variable immutability, much the reverse in fact ( same as var)
perhaps we could go for a more truthful keyword 'as_const_as_we_can_get' ( acawcg) for indicating the constantness cobra is providing
Forums
const / readonly member
12 posts
• Page 2 of 2 • 1, 2
Re: const / readonly member
Perhaps we can still support the "const" semantics even on the JVM since this is a function of the compiler. In other words, it could read the value from the JVM package that is referenced and then inline it.
- Charles
- Posts: 2515
- Location: Los Angeles, CA
12 posts
• Page 2 of 2 • 1, 2
Who is online
Users browsing this forum: No registered users and 49 guests