[Glass] Best Practice To Programmatically add an instance variable to an existing class?

Martin McClure via Glass glass at lists.gemtalksystems.com
Wed Aug 16 23:51:57 PDT 2017


On 08/16/2017 06:34 PM, Reg Krock via Glass wrote:
> HI,
> 
> What is the best practice for dynamically adding an instance variable to an existing class?
> 
> There are two classes in Behaviour -
> 	#addInstVarName:
> 	#addInstVar:
> 

Generally, classes in GemStone are immutable, so you have to create a
new class version in order to add an instance variable. You can do that
with messages in the class creation protocol.

If the class has instances, it's definitely immutable, and you'll most
likely want to migrate the instances to the new class version. The
Programming Guide has information about that.

Regards,
-Martin


More information about the Glass mailing list