Page 1 of 1

Persistent Objects

Posted: Mon Feb 23, 2015 8:10 pm
by yari
Hello everyone...
I'm trying to create persistant objects in logtalk. Assertions and retractions should update a file.
I need multiple objects to be stored in the persistent database.
I am trying to use the persistency library in SWI-prolog, is this possible?
If so, how should the 'persistent' directive be used in a logtalk file?
if not, what is the best to integrate swipl persistency and logtalk?
Thanks in advance.

Re: Persistent Objects

Posted: Mon Feb 23, 2015 8:42 pm
by Paulo Moura
The SWI-Prolog "persistency" library assumes and requires that the calls to the persistent predicates be made from within modules. Thus, it cannot be used as-is with Logtalk objects. The library code can be ported, however, if necessary. A simpler solution is possible, however, if it would be enough to load the files holding the persistent databases when the Logtalk objects are loaded and to dump the updated databases when terminating the session.

Re: Persistent Objects

Posted: Mon Feb 23, 2015 11:12 pm
by Paulo Moura
Added a simple implementation of a persistent object database (using the includes/1 directive) to the current Logtalk git version:

https://github.com/LogtalkDotOrg/logtal ... s/includes

Re: Persistent Objects

Posted: Wed Feb 25, 2015 1:24 pm
by yari
Thank you for your answer and for creating logtalk :)