links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
Last updated at 9:14 am UTC on 26 September 2019
Every graphical object (including strings) you see on the screen within a Morphic Project is a Morph. Morphs may be "light" or "heavy".

To save space Morph objects havew only a few instance variables. They are

For simple morphs this is sufficient. Note that the value of the 'extension' variable is not set. That is the value is 'nil'. For complex morphs it will contain a reference to a MorphExtension object. This will contains the extra information and functionality.


In Pharo

This shows that in Squeak and Pharo for more complex morphs an MorphExtension object (= an instance of the MorphExtension class) is attached to the Morph object in question. It keeps the additional instance variables the Morph needs. This is done with lazy initialisation.

To even add more flexibility the MorphExtension instance includes an instance variable called 'otherProperties'.
It holds an IdentityDictionary where additional data may be kept.

You may use 'otherProperties' to add your own data to a morph.

You do not have to deal with MorphExtension directly. You just use messages of the type

you simply send to the aMorph.

Note: properties have to be in the form of aSymbol, not aString.)



This mechanism allows a Morph object "to grow" in complexity while still maintaining a good performance for simple, frequently used morphs.