Squeak
  links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
Immutability Bit
Last updated at 12:32 pm UTC on 17 January 2006
From http://www.cincomsmalltalk.com/CincomSmalltalkWiki/VisualWorks+7+White+Paper:

"Immutable Object Support.

Immutability is implemented as a per-object "is immutable" bit that the Smalltalk compiler sets for CompiledMethods and literals there-in, and that persistence managers (an OODBMS or O/R framework) set on database proxies. When an attempt is made to assign to an instance variable of an immutable object the object gets sent attemptToAssign: aValue toIndex: theIndex. When a primitive such as at:put: or become: attempts to modify an immutable object the primitive fails (with an appropriate error code "ErrorNoModification"; eem 7/4/04). At the image level a NoModificationError is raised. In persistence context the NoModificationError then attempts to find a manager for the object refusing to be modified before delivering the error if no manager steps up to the plate. Thus persistence managers can implement facilities like transparently writing through changes to the database without modifying the code base in any way."