|Adding const to java firstname.lastname@example.org (Ghulam Lashari) (2002-10-24)|
|Re: Adding const to java email@example.com (Onder Karpat) (2002-11-06)|
|Re: Adding const to java firstname.lastname@example.org (Joachim Durchholz) (2002-11-06)|
|Re: Adding const to java email@example.com (Ben L. Titzer) (2002-11-06)|
|Re: Adding const to java firstname.lastname@example.org (Nils Hagge) (2002-11-06)|
|Re: Adding const to java C.vanReeuwijk@twi.tudelft.nl (Kees van Reeuwijk) (2002-11-06)|
|From:||"Ben L. Titzer" <email@example.com>|
|Date:||6 Nov 2002 11:50:31 -0500|
|Posted-Date:||06 Nov 2002 11:50:31 EST|
On 24 Oct 2002, Ghulam Lashari wrote:
> I have implemented "const" modifier in Java Programming Language. The
> semantics of const are similar to that of C++. I am trying to experiment if
> there is any usefulness of this modifier for example in gc etc. I am looking
> for some opinions/suggestions here about what domains of the usefulness of
> this modifier can/should be explored (for example in Virtual Machine
How do the semantics of this modifier differ from final? In that you
can't modify the fields of the particular object?
IMO, I think const is the biggest pain in the ass in C++. Objects are
either going to have public fields or not. Doing this on a per
reference basis is a mess. Besides, it's all subvertible anyway.
As for the usefulness for the runtime, it's isn't all that useful.
Specifying that a section of code will only read a field and not write
it isn't particularly useful in itself. Caching wouldn't be correct
because the field could still be changed concurrently or by methods up
the call stack. Final is more useful for compilers because the field
can be cached without worry about concurrent modification.
Return to the
Search the comp.compilers archives again.