|
From: | Paolo Bonzini |
Subject: | Re: [Help-smalltalk] Code update and class variables |
Date: | Mon, 06 Sep 2010 12:24:02 +0200 |
User-agent: | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.10) Gecko/20100621 Fedora/3.0.5-1.fc13 Lightning/1.0b2pre Mnenhy/0.8.3 Thunderbird/3.0.5 |
On 09/06/2010 11:46 AM, Holger Hans Peter Freyther wrote:
On 09/06/2010 04:30 PM, Paolo Bonzini wrote:It's a bit ugly, but not strictly a bug. I suggest you use a dictionary, and #doesNotUnderstand: instead of a getter, especially because you're adding the instance variables to _all_ instances of LogConfig rather than just one.Two more questions 1.) is it possible to only add instance variables only to one instance? How would I do it? '123' addInstVarNamed didn't work here.
You need to create a "lightweight class", like | cl | cl := Behavior new. cl superclass: instance class. instance changeClassTo: cl. cl addInstVarNamed: 'a'.However, it's broken and only works if "instance class" has no instance variables at all. I'll shortly push a fix.
2.) #doesNotUnderstand will not work from what I see as the Logging Module does not know who is going to add areas to it, unless I do something like LogConfig allSubClassesDo: []... is that appropriate?
I don't understand why would you subclass LogConfig rather than create multiple instances?
Paolo
[Prev in Thread] | Current Thread | [Next in Thread] |