Pressures for Substantially New Squeaks

Reinier van Loon R.L.J.M.W.van.Loon at inter.nl.net
Sat Feb 13 20:50:28 UTC 1999


Stefan,
>
>>    thingLabSliderClass := self classAt: 'Slider' in: 'ThingLab'.
>>    morphicSliderClass := self classAt: 'Slider' in: 'Morphic'.
>
>I'd prefer something like 'Morphic::Slider' instead of the above message
>expression or 'Morphic.Slider' to stay compatible with ObjectShare's
>approach, but that's just syntactic suggar.


Yes and no. If the name would be one string, the protocol would simply
become 'classAt: aString'.
And classAt: could be implemented to use classAt:in: as in:

classAt: aString
    "Answer the class referenced by aString. A string reference to a class
without a dot or double colon is considered a reference to a class in the
current locations. A string with either a dot or double colon is split in
two: the part before the dot or double colon is considered a name space name
and the part after it, the class name."

    hasDot := aString includesSubString: '.'.
    hasDoubleColon := aString includesSubString: '::'.
    ( hasDot or: [ hasDoubleColon ] ) ifTrue: [
        stream := ReadStream on: aString.
        hasDot ifTrue: [
            vocabulary := stream upTo: $..
        ] ifFalse: [
            vocabulary := stream upTo: $:.
            stream next.
        ].
        className := stream upTo: 0 asCharacter.
        ^self classAt: className in: vocabulary
    ] ifFalse: [
         ^self classAt: aString in: 'Smalltalk'
    ].


Anyway, this is just one solution. You could substitute the hard coded
recognition by a loop which asks instances of ClassReference if they could
handle a given reference and if they do, let them handle it as in:


classAt: aString
    self classReferenceHandlers do: [ : each |
        ( each hasClassAt: aString ) ifTrue: [
            ^each classAt: aString
        ].
    ].

So, we could even use references like this: 'Squeak/Morphic/Windows/Slider'
and 'Reinier.ThingLab.Special.Slider' or the category names as used in
Squeak today. So, ReadStream would be referenced by
'Collections-Streams.Readstream'.

Andrew is right. All the stuff is there, it's not hard to do it, it's just a
Squeak Central thing.

Reinier.





More information about the Squeak-dev mailing list