could we fix MorphicModel

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

could we fix MorphicModel

stephane ducasse
gary?

Do you have surgeon knife?
Because I do not see why slider need to depend on that wonderfully designed code.

use: cachedSelector orMakeModelSelectorFor: selectorBody in: selectorBlock
        | selector |
        model ifNil: [^ nil].
        cachedSelector ifNil:
                        ["Make up selector from slotname if any"
                        selector := (slotName ifNil: [selectorBody]
                                                                ifNotNil: [slotName , selectorBody]) asSymbol.
                        (model class canUnderstand: selector) ifFalse:
                                [(self confirm: 'Shall I compile a null response for'
                                                        , Character cr asString
                                                        , model class name , '>>' , selector)
                                                ifFalse: [self halt].
                                model class compile: (String streamContents:
                                                                [:s | selector keywords doWithIndex:
                                                                                [:k :i | s nextPutAll: k , ' arg' , i printString].
                                                                s cr; nextPutAll: '"Automatically generated null response."'.
                                                                s cr; nextPutAll: '"Add code below for appropriate behavior..."'.])
                                                        classified: 'input events'
                                                        notifying: nil]]
                ifNotNil:
                        [selector := cachedSelector].
        ^ selectorBlock value: selector
_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: could we fix MorphicModel

Gary Chambers-4
Indeed, one of the more beautiful bits of Etoys...

Regards, Gary

Sent from my iPad

On 27 Aug 2010, at 10:29, stephane ducasse <[hidden email]> wrote:

> gary?
>
> Do you have surgeon knife?
> Because I do not see why slider need to depend on that wonderfully designed code.
>
> use: cachedSelector orMakeModelSelectorFor: selectorBody in: selectorBlock
> | selector |
> model ifNil: [^ nil].
> cachedSelector ifNil:
> ["Make up selector from slotname if any"
> selector := (slotName ifNil: [selectorBody]
> ifNotNil: [slotName , selectorBody]) asSymbol.
> (model class canUnderstand: selector) ifFalse:
> [(self confirm: 'Shall I compile a null response for'
> , Character cr asString
> , model class name , '>>' , selector)
> ifFalse: [self halt].
> model class compile: (String streamContents:
> [:s | selector keywords doWithIndex:
> [:k :i | s nextPutAll: k , ' arg' , i printString].
> s cr; nextPutAll: '"Automatically generated null response."'.
> s cr; nextPutAll: '"Add code below for appropriate behavior..."'.])
> classified: 'input events'
> notifying: nil]]
> ifNotNil:
> [selector := cachedSelector].
> ^ selectorBlock value: selector
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project