[Seaside] Class Variable Browser Fix

Ted Wrinch ted.wrinch at gmail.com
Thu Jul 14 13:21:31 UTC 2011


I guessed it was Omnibrowser, but I will try and post to the appropriate list. Actually, I've just checked Pharo and I can reproduce neither issue there so maybe Seaside isn't the worst list for this.  BTW: I'm guessing OB provides all those nice code checking and refactoring tools; in which case I thinks it's a great addition to the Smalltalk environment. One thing I would suggest adding is colour coding for errors in methods that are selected in the browser. It currently only checks code that is being added or modified. It would be particularly helpful feature to partially overcome Smalltalk's weakness in allowing code to exist which references non-existent, renamed or removed methods. 

Ok, I've gone back to a clean Seaside image and changed the offending line back to:

(requestor selectedClass notNil and: [ (binding := requestor selectedClass bindingOf: target selector) notNil and:[binding value notNil]])

For this case if I go to the ButtonDecodeTable class variable in InputEventSensor and right click I get a walk-back. If I change the line further to:

(requestor selectedClass notNil and: [ (binding := requestor selectedClass bindingOf: target selector) notNil and:[binding value notNil and:[binding value class canUnderstand: #asNode]]])
 
I don't. But testing is hard and I maybe missing something here.

T.

Ted Wrinch




On 14 Jul 2011, at 09:12, Lukas Renggli wrote:

>> If you go to a class variable usage in the browser, say DefaultDirectory in FileDirectory>>default, and select and right click it, Seaside brings up a walk-back.
> 
> I cannot reproduce that.
> 
> Also note, that this is not Seaside related, but OmniBrowser (I thus
> reply to the Pharo list).
> 
>> My fix for this re-writes the existing method a little by using '&' instead of the older 'and:', which I find clearer. What I've done is check that the value can respond to #asNode:
>> 
>> globalReference
>>        | binding |
>>        target hasSelector
>>                ifFalse: [ ^ nil ].
>>        (requestor selectedClass notNil & (binding := requestor selectedClass bindingOf: target selector) notNil & binding value notNil & (binding value class selectors includes: #asNode))
>>                ifTrue: [ ^ binding value asNode ].
>>        (binding := Smalltalk classNamed: target selector) notNil
>>                ifTrue: [ ^ binding value asNode ].
>>        ^ nil
> 
> This certainly introduces other bugs. The use of the non-eager #and:
> is intentional, because if "requestor selectedClass" is nil,
> "requestor selectedClass bindingOf:" is not supposed to be evaluated.
> 
> Lukas
> 
> -- 
> Lukas Renggli
> www.lukas-renggli.ch
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside



More information about the seaside mailing list