Duplicate :
|
|
Relates :
|
|
Relates :
|
Name: dbT83986 Date: 04/13/99 It would be real cute to be able to mark objects as being Immutable (as per Strings). This means that the internal state is not permitted to change after creation. This would allow extra optimisations at compile time. It would then be useful to mark objects as being Primitive objects. Only Immutable objects should be allowed to be Primitive. Primitive objects would have the property that if a == b, then a.equals(b) is also true (ie the object reference is formed from the object's internal state such that two objects with the same internal state are actually the same object - hence the need for Immutability). i.e. public interface Immutable {} public interface Primitive extends Immutable {} Then int, long, float, double, short, char, byte, boolean are all Primitive String is Immutable (and should be Primitive). You see that Primitive types are the only types that can be dealt with properly at compile time. It would also be nice to re-introduce the const keyword, marking any object instance as immutable (not the class) for things like constants and parameters!!!! (Review ID: 56888) ======================================================================
|