Class instances are interned if the same constructor parameters produce
the same class instance. If points are interned, a coordinate pair (x, would have at most one associated point instance independent of the number
of times new point(x, y)
was called (if it was called zero times, there
wouldn't be any class instances).
Interning is handy because equality reduces to identity. On the other hand, mutable classes are difficult unto impossible to intern because each instance-state change requires an instance change too. Interning was originally developed as a compile-time optimization that saved space by mapping each occurrence of a constant in the program text to the same representation in the binary. Some languages defined values, such as lisp atoms, that were required to be interned, which extended interning to run-time and made it possible to implement value equality as fast address comparisons.
This page last modified on 24 January 2006.