Le 26/07/2012 18:29, Alexander Burger a écrit :

Note that (; 'objContent containers) is not correct, because the quoted
symbol 'objContent' doesn't evaluate to an entity.

Better would be (; objContent containers). But this wasn't a problem
here, because both expressions still give NIL.



Thanks for the hint. My "non simplified" code must not have the quote, because I was able to add a second element to the list. I simply didn't check this case here, as I got the expected result...


(zap objContainer)

This is the problem! 'zap' should generally not be called in application
code, because it does a hard-core removal of the object, without taking
care of relations.

Use (lose!> objContainer) to clean up all relations as needed, and mark
the object for final deletion. This will happen at the next call of
'dbgc'

    (load "@lib/too.l")
    (dbgc)

'dbgc' is usually called by a process started from a nightly cron job,
and internally calls 'zap' if the object is not referenced from other
objects.



Great info! Thanks!


: (show objContent)
{3} (+Content)          # The joint is gone
    data 25

: (show objContainer)
    T                    # Object is marked for deletion
    contents ({3})
    data 52
-> {2}

    (Note that the back-link 'contents ({3})' still exists in the "lost"
    object. So you still can undo the 'lose>' here with

       (keep!> objContainer)

    and the full joint would be re-established)


And this could be useful, too!
I didn't see info about those two messages in the database tutorial (I just fount it in the doc for +Entity... Didn't think about searching there...)


: (dbgc)  # Call garbage collector
-> 2

:  (show objContainer)
!? (val "X")
{2} -- Bad ID           # Object is gone
{2} ?


Please consider that I'm very new to picolisp (and to lisp more
generally) so I may make basic mistakes.

No problem! :)


I knew it was a basic mistake ;-)

Thanks again.

--
Laurent ARTAUD (laurent.art...@free.fr)
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to