Modifying MethodContext?

Andreas Raab Andreas.Raab at gmx.de
Tue Jul 24 05:32:56 UTC 2001


Stephen,

> I need to add an instance variable to MethodContext.

No. You don't. Not unless you're trying to modify the execution of contexts
(e.g., the VM aspect of it). Adding "instance variables" can be done in a
much simpler and less intrusive way.

> What is the best approach to doing so?

Use something like Object's DependentsFields, e.g., implement

MethodContext>>foo
	^FooRegistry at: self ifAbsent:[nil]

MethodContext>>foo: bar
	FooRegistery at: self put: bar

If you use weak dictionaries they'll even go away automatically.

Cheers,
  - Andreas





More information about the Squeak-dev mailing list