Hi Konrad,

ah, now I know!

On Wed, Mar 21, 2012 at 12:19:07PM +0100, Alexander Burger wrote:
> > I'm trying to write a newX function for a +Entity subclass and its
> > behaving rather strangly. The code is as follows:
> > 
> > (de newAdversary (Nm Tp Abs Spd Ht Def Arm)
> > ...
> > : (show '{2})
> > {2} (+Adversary)
> >    armour 0
> This looks all right (at least on the first glance).

No, forget that.

Using (=: var <value>) circumvents the relation management mechanisms.
In general, 'put>' (or 'put!>') is used instead of '=:' on DB entities.


>       (dbSync)
>       (new (db: +Cls) '(+Cls) 'a A  'b B  'c C  ...)
>       (commit 'upd)


>       (new! '(+Cls) 'a A  'b B  'c C  ...)

will not only be shorter, but calls 'put>' internally, causing indexes
and other relations to be properly handled.

This explains why 'select' couldn't find anything.

To do it explicitly, the equivalent would be

      (with (new (db: +Cls) '(+Cls))
         (put> This 'a A)
         (put> This 'b B)
         (put> This 'c C)
         (commit 'upd)
         This )

Sorry, didn't notice this while answering your first mail ;-)

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

Reply via email to