Why is a NullStyler necessary when Shout can load without overriding any code? Lukas 2010/5/22 Mariano Martinez Peck <marianopeck@gmail.com>:
On Sat, May 22, 2010 at 10:09 AM, stephane ducasse <stephane.ducasse@free.fr> wrote:
Hi guys
what do we do with shout? Squeak introduced it directly in the system. Now I was thinking that what could be a solution is to have a default API/null pattern class that could be in the core and that when Shout gets loaded the shout class is used instead.
Wasn't this the idea of ToolSet ? but sucks...(as we said few threads ago)
Now we could add Shout to the TextEditor package but I would like to understand how we can do it without.
This is an excellent question and idea. Using some kind of Strategy pattern or similar may help. But I 9999999999^9999999Â not to put Shout neither Style in Core ;)
I haven't look anything about the code. I have no idea. But cannot CodeMorph or whatever have a class variable that holds the Styler? Then we create, as you said, a NullStyler for core. Shout implements its own Styler and when loaded, it does: CodeMorph styler: ShoutStyler or similar.
I guess the NullStyler is better than having to do everywhere codeMorph styler isNil ifFalse: [ ....
Cheers
Mariano
And also it is interesting to see if one day we will need selector namespace or something like that to deal well with extensions. Stef
in PharoCore-1.1 11367
Fails as CodeMorph#stylerClass is not initialized. And no *Styler* class exists on PharoCore....
To make test passes on Pharo I've written
CodeMorph#defaultStylerClass  ^ SHTextStylerST80
CodeMorph#stylerClass  ^ stylerClass ifNil: [stylerClass := self defaultStylerClass].
the solution proposed by laurent only works when shout is loaded and this is not always the case.
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
-- Lukas Renggli www.lukas-renggli.ch