First let me thank you and Henrik for the insight you gave me. Alexander Burger wrote: > And one more thing I just remember: > > On Wed, Dec 09, 2009 at 01:10:21PM +0100, Alexander Burger wrote: >> There is no separate 'set'ter function needed, as the 'any' >> argument in >> >> (var sym . any) > > A 'set'ter function would be pretty useless if there is no value yet, > or if the value were set to NIL once, because if there is no value > the property cannot be inherited, i.e. the class in the hierarchy > that is supposed to receive that value cannot be found :-) > > So a NIL value _must_ be defined as > > (var name NIL) > > to have a cell with NIL in its CAR, but still a non-empty property > that can be inherited. Later you can do things like > > (set (var: name) 123) > > and the '123' will arrive in the correct class.
Stupid me, but I did not recognize that I could use 'set' for those task :-} This would be exactly the behavior I need ... But there seems to be something that slip me. I have wrote some example code, that show the behavior I need. ==========================8X========================== (class +Foo) # id (var N 0) (var Foos ()) (dm nextId> () (set (var: N) (+ (car (var: N)) 1))) (dm T () (=: id (pack "Foo#" (nextId> This))) (conc (var: Foos) (list (cons (: id) This))) ) # (dm foos> () (mapcar '((X) (car X)) (var: Foos))) # *1a* # (dm foos> () (mapcar '((X) (car X)) (get '`*Class 'Foos))) # *1b* (dm foos> () (mapcar '((X) (cdr X)) (get '`*Class 'Foos))) # *1c* (dm show> () (prinl "Foo id=" (: id))) (show> (new '(+Foo))) (show> (new '(+Foo))) (show> (new '(+Foo))) # (prinl "Foos: " (mapcar '((X) (prinl X)) (foos> '+Foo))) # *2a* # (prinl "Foos: " (mapcar '((X) (prinl (type X))) (foos> '+Foo))) # *2b* (prinl "Foos: " (mapcar '((X) (show> X)) (foos> '+Foo))) # *2c* (show '+Foo) ==========================8X========================== The idea is, that every instance get an id generated by a counter implemented as class variable 'N'. Then the constructor will register the instance in a assoc list also held by a class variable too 'Foos'. If you execute the code as is, an error will issued at *2c*, that the message 'show>' is not understood. But if * I use *1b* and *2a* instead of *1c* and *2c* the correct id stored in the CAR of every element in the assoc list will be printed. * I use *1c* and *2b* instead, a type of +Foo will be reported for every instance held in the CDR of every association. * However, using *1a* instead of *1b* or *1c* will get me nowhere at all, despite I think it should have worked :-( To summarize, *1a* will not deliver, what I expect, but *1b* and *1c* seem to return what I want! Asking for the type of every instance held in the association list *2b* will answer +Foo correctly. But sending a 'show>' to every instance (*2c*) will repsond with "Bad message". So please enlight me, where is my stumble block? What did I wrong? Thanks and ciao, cle. -- UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe