TWiki . Dev . AddingConstness

On a longer term(post 1.0) Nice might get a const keyword. Anyone who's is interested in writing a proposal should look at this proposal for java:

It's a very good starting point in my opinion.

An extension to Java exists that add constness:

-- ArjanB

How would this be different from let?

-- IsaacGouy - 17 Sep 2003

When using let or final in java you can't change the reference. And const is like in c++ that the object that is referenced may not be changed.

-- ArjanB

I never much liked "const" as it exists in C++. The problem is that an object might appear to be mutable or immuable depending on where you are in the code. So a "const" object might change due to action somewhere else in the program.

Much better to have true immutable objects. Perhaps mutable and immutable versions of the same type, similar to !T and ?T.

Final instance variables in Java provide finer control since you can make an object partially immutable.

-- BrianSlesinsky - 21 Nov 2003

----- Revision r1.4 - 21 Nov 2003 - 07:40 GMT - BrianSlesinsky
Copyright © 1999-2003 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback.