Hi Thorsten,

> (class 1 ...)
> (dm ...)
> (dm ...)
> 
> (class 2 ...)
> (dm ...)
> (dm ...)
> 
> The reader seems to remember which class was defined last, and
> associates the following methods to that class.

Not the reader, but the 'class' function:

   (de class Lst
      (let L (val (setq *Class (car Lst)))
         (def *Class
            ...

It remembers that class in the '*Class' global.

So the 'class' function is not absolutely necessary.


> Would you rather write the classical definitions to a file and then load
> that?

No, it is perfectly legal to build the class structures manually as you did. The
class definition in your first mail was correct.

What was missing was only the definition for methods like 'hi>'. Without them,
'hi>' is just a symbol with value 'NIL', so that calling it like

   : (hi> Obj)
   !? (hi> Obj)
   hi> -- Undefined
   ?

naturally gives an "Undefined" error. This has nothing to do with classes and
OOP. Instead, you could send the message to 'Obj' explicitly with

   (send 'hi> Obj)

or

   (try 'hi> Obj)


Defining with 'dm' just takes care to set the proper function definition for
the symbol 'hi>'. Instead, you could also do

   (setq hi> meth)

or perhaps better

   (def 'hi> meth)

Now also a call like (hi> Obj) works.

♪♫ Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to