Hi Henrik,

> (class +User +Entity)
> (rel id (+Key +Number))
> (rel nm (+Key +String))
> (dm hi> () (print (; This nm)))
> 
> (class +Admin +User)
> (dm hi> () (print "Hi admin."))
> 
> (setq *Admin (db 'id '+User 3))
> (push *Admin '+Admin)
> (hi> *Admin)
> 
> Note that +User is the base class that is specified in the dbs call.
> 
> So I want that line to output "Hi admin" which it will, I just want to make
> sure that this is the best way of doing it. If I try:
> 
> (setq *Admin (db 'id '+Admin 3))
> (hi> *Admin)
> 
> It doesn't work, but maybe it does if some configuration is set up that I
> don't know about?

The above seems correct, and works here (i.e. prints "Hi admin.").


However, pushing the class +Admin into the +User object results
in that object having two primary entity classes.

   : (show *Admin)
   {2} (+Admin +User)
      nm "Hugo"
      id 3

Now this object inherits from '+Entity' twice.

While this doesn't really matter, I would rather set a new class(list)
with

   (set *Admin '(+Admin))

resulting in

   : (show *Admin)         
   {2} (+Admin)
      nm "Hugo"
      id 3

or, alternatively, define '+Admin' as a prefix class

   (class +Admin)  # i.e. without inheriting from '+User'


BTW, (; This nm) is a kind of tautology. Could simply be (: nm)

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

Reply via email to