How do Smalltalk disambiguate messages?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
24 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Re: How do Smalltalk disambiguate messages?

CodeDmitry
This post was updated on .
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: How do Smalltalk disambiguate messages?

Ben Coman
In reply to this post by Charlie Robbats
On Sun, Oct 16, 2016 at 9:11 PM, Charlie Robbats
<[hidden email]> wrote:

> Here, Dmitry, try this code in playground...maybe helps you understand
>
> | lookupClosure |
> lookupClosure := [].
> lookupClosure := [:cls :selector |
>     (cls == nil)
>         ifTrue: [Warning signal: ('selector lookup failure: ', selector)].
>     (cls methodDictionary
>         at: selector
>         ifAbsent: [nil])
>             ifNil: [lookupClosure value: cls superclass value: selector]
>             ifNotNil: [:meth | Smalltalk tools browser openOnMethod: meth]].
> lookupClosure value: Array value: #at:put:.

Nice example.  Slightly improved...

| lookupClosure |
lookupClosure := [].
lookupClosure := [:cls :selector |
    (cls == nil)
        ifTrue: [Warning signal: ('selector lookup failure: ', selector)].
    cls methodDictionary
        at: selector
        ifPresent: [:meth | Smalltalk tools browser openOnMethod: meth]
        ifAbsent: [lookupClosure value: cls superclass value: selector]].
lookupClosure value: Array value: #at:put:.

cheers -ben

Reply | Threaded
Open this post in threaded view
|

Re: How do Smalltalk disambiguate messages?

Charlie Robbats
Banned User
This post was updated on .
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: How do Smalltalk disambiguate messages?

Charlie Robbats
Banned User
This post was updated on .
CONTENTS DELETED
The author has deleted this message.
12