On Sun, Oct 16, 2016 at 9:11 PM, Charlie Robbats
<charlie.robb...@gmail.com> 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 via email to