Pressures for Substantially New Squeaks

Reinier van Loon R.L.J.M.W.van.Loon at inter.nl.net
Sat Feb 13 19:19:29 UTC 1999


[snip]
>> Now, if we can discipline our selves to always specify which dictionary
to
>> use the problem can be solved at Object level.
>> Example (an actual problem for me when working on ThingLab)
>>
>>     thingLabSliderClass := self classAt: 'Slider' in: 'ThingLab'.
>>     morphicSliderClass := self classAt: 'Slider' in: 'Morphic'.
>
>Rein imposes quite a bit of discipline on himself and others.  I, for
>one, find merit in the syntactic sugar of being able to create
>strings simply by reference to the class "String," rather than having
>to use, the onerous:

Yip, a lot of discipline. It was just to make things clearer.

>
> stringClass _ self classAt: #String in: #Smalltalk
> foo _ stringClass new: 20
>
>he would observe, correctly, that it would be unnecessary since that
>is the default dictionary.  My point, precisely!  Users preferring
>the cleaner syntax
>
> foo _ String new: 20
>
>for things other than basic types will be encourages simply to forego
>the "benefits" of the discipline.


To have the benefits of the syntax and name spaces I patched the method
Class>>scopeHas:ifTrue: like this:
"patch"
self locations associationsDo: [ : each |
    assoc := each value associationAt: varName ifAbsent: [ nil ].
    assoc == nil ifFalse: [
        assocBlock value: assoc.
        ^true
    ].
].
"end of patch"
superclass == nil ...

Now you can type any crazy name, as long as it is defined in locations. So,
instead of typing String I could type Tekenreeks (a possible Dutch name for
String) and have it compile String.
>
[snip]
>Agreed that the language needn't be changed to accomplish the task,
>but it ought to take less than (what will appear to most as)
>fundamental system hacking to accomplish.
>
Yip. It is in fact quite simple. I am even playing with the idea to fully
substitute the method scopeHas:ifTrue: with just the patch.
Currently, the tactics for resolving names is hard coded ( first: check
symbol, then check class variables, then pools, then if you have a super
class ask your else look in Smalltalk). This can be replaced with a protocol
which asks where to look for a name. The currenty hard coded search path is
then the default one at Object level.

One more thing: It is sometimes necessary to rename a class and in such a
case it is nice that you have separated its implementation name from its
interface name.

Reinier.





More information about the Squeak-dev mailing list