Wide Classes

If you browse to WideClass and WideClassTest on How to access the SCG visualworks store there is a simple implementation of wide classes. The idea of wide classes is based on work by Manuel Serrano, please refer to his ecoop paper on wide classes. A wide class is a class that can become larger when needed and shrink again later. As we have tons of empty inst vars in Moose models, that might help us to save some megas on large case studies.


How does it work?

Sending #wide: >put: to some object will install an instance var and accessors on the receiving instance.

	o := Object new.
	o widen: 'foo'.
	o foo: #whatever.
	o foo 

and even better, if you implement in a class #foo and #foo: as follows

	foo ^nil
	foo: arg self wide: #foo put: arg

upon first execution of #foo: the foo inst var is installed in a per-instance base and both methods get properly overriden with simple accessors. Wide classes and objects should work with the inspector as well. There is no DNU hack anywhere, thanks to Travis for pointing me to the right implementation.

	self changeClassTo: Array.
	self become: (self copyWith: nil).
	self changeClassTo: wideclass
Last changed by admin on 21 April 2009