On Mon, Sep 6, 2010 at 09:11, Holger Hans Peter Freyther <[email protected]> wrote: > Hi all, > > I am currently 'porting' (redoing) the OpenBSC/Osmocom logging framework in > Smalltalk and while developing I see that I have one question/issue with > updating the code. > > I have a LogArea which is a three tuple of (description, enabled, minLevel), I > have a LogConfig that holds a list of areas and gives them local names. > > So I have something like: > > Object subclass: LogConfig [ > Config := LogConfig new. > > LogConfig class >> default [ > ^ Config > ] > > addArea: anArea name: aName [ > addInstanceVariableAndSetIt > GenerateGetMethod... > ] > ] > > and in another Package/Namespace I would do.. > > log.LogConfig defaut addArea: localArea: #localName..
Passing note: namespaces are usually capitalized. > Now I have two issues: > 1.) 1 to 3: [SomeClass class addInstVarName: #boo], will add #boo > three. Is that a bug? That should not be possible, bad things > will happen as a result.. 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. > 2.) FileStream fileIn: 'Log.st'. will set Config back to a new > instance of LogConfig and all added areas are gone. What are the > workarounds? Put Config into the Smalltalk dict? Use Notifications > so people can add their areas again? This would be fixed by using a dictionary and #doesNotUnderstand:, too. Paolo _______________________________________________ help-smalltalk mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-smalltalk
