[squeak-dev] Dependencies on Cursor

Frank Shearar frank.shearar at gmail.com
Mon Jun 24 17:43:52 UTC 2013


On 24 June 2013 18:30, tim Rowledge <tim at rowledge.org> wrote:
>
> On 24-06-2013, at 5:31 AM, Frank Shearar <frank.shearar at gmail.com> wrote:
>>  You would then write:
>>
>>    UIManager default showCursor: #wait during: ["stuff"]
>
>> snip]
>
>> The reason for the icky reflection is to fit in with the existing way
>> cursors are used. I'd be happy to unroll the #perform: into a #caseOf:
>> mapping explicitly to the existing cursors.
>>
>> Thoughts
>
> Well I really dislike seeing #respondsTo: et al in general code so I'd propose something along the lines of a list of known cursors (it's reasonable in my opinion to make that list using reflection at either startup or add-new-cursor time) and then
>
> Cursor class >> #named: aSymbol
>    ^  cursorList at: aSymbol ifAbsent:[self normal]

Yep, reflection hides the actual API, and makes things slow as well.
So in Cursor's particular case, it has loads of classvars with names
of the form FooCursor, Foo naturally corresponding to the selector
#foo. So there's CrossHairCursor, BlankCursor, etc. That means you end
up duplicating the list of cursors (between the set of class vars and
cursorList), or you make a rather invasive change of ripping out all
the class vars. A middle ground might be this:

Cursor >> named: aSymbol
    ^ aSymbol caseOf: {
       [#down] -> [self down].
        [#wait] -> [self wait].
    } otherwise: [self normal].

frank

> tim
> --
> tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
> Strange OpCodes: CCC: Crash if Carry Clear
>
>
>


More information about the Squeak-dev mailing list