Updating system classes.

Andrew P. Black black at cse.ogi.edu
Sat Jun 7 23:51:46 UTC 2003


At 16:29 -0700 06/06/2003, Andrew P. Black wrote:
>Along the way, I encountered a need to clean up the various kinds of 
>Association, for example, so that ReadOnlyVariableBindings print as 
>a -> b.  But that is another topic.

Ok, so let's switch topic.  I haven't been Squeaking for a bit, so 
please be patient.  I see this as a modest contribution to the Kernel 
Cleaning Project, and it has given me an appreciation of how 
difficult a task KCP is.

I decided, just for fun, to try to rationalize Association, 
ReadOnlyVariableBinding (which should probably be called 
ReadOnlyAssociation), and the two kinds of WeakAssociation.

First I wrote some tests, which duly failed in six places:

	with Associations, WeakKeyAssociations, and ReadOnlyVariableBindings,
		#one->1 is equal to #one->2
	with ReadOnlyVariableBindings and WeakValueAssociations, only 
the key is printed by printOn:

I think that I know what = should do, but now I'm asking the 
customer: how should ReadOnlyVariableBindings and 
WeakValueAssociations print?  I am willing to believe that some 
distinction between ReadOnlyVariableBindings and ordinary 
associations is desirable, but I don't believe that omitting the 
value is the right distinction!  I suggest either

	#one->1

just like an association, or

	#one=>1

to indicate the unchanging character of the mapping.  I claim that 
WeakValueAssociations should print just like WeakKeyAssociations, 
i.e., the same as Associations.

Note that storeOn: passes my tests in every case, because here the 
actual class name is printed on the stream.

OK, so I have implemented several new classes:

	APBAbstractAssociation #()
		APBAssociation #('value')
			APBReadOnlyVariableBinding #()
		APBHalfWeakAssociation #()
			APBWeakKeyAssociation #()
			APBWeakValueAssociation #()

and they pass my tests.

So now the next question is: how do I install them in my image,  that 
is, use them to replace the corresponding classes without the APB 
prefix.  I can't rename APBAssociation to Association, because 
Association already exists.  I can't delete the class Association, or 
rather, I can, but it crashes my image silently.  I would think that 
moving Association to Undefined, and then renaming APBAssociation to 
Association, followed by 'becoming'  all of the old Associations to 
the new Associations might work, but I'm not clear how to do this in 
detail.

Finally, what is the appropriate stage to hand this off to the KCP? 
Right now I have a nice clean change set, but all it does is define a 
few tests and some APB-classes.  If I succeed in installing all of 
this stuff, I won't have that any more.  What would KCP like?

What's a weekend Squeaker to do?  (OK, the answer is probably to 
start with a less invasive project.  But I plan to have a student 
this summer work on installing the Collections that Nathanael and I 
wrote with traits into an image *in place of* the ordinary 
collections.  This will be a similarly invasive change, and I would 
like to figure out how to do it.)

	Andrew





More information about the Squeak-dev mailing list