[mercury-users] Assert/Retract

Ian MacLarty maclarty at cs.mu.OZ.AU
Fri Jan 27 18:33:47 AEDT 2006


On 27 Jan 2006, at 06:48, Ralph Becket wrote:

> Daniel Elenius, Thursday, 26 January 2006:
>> No, because *new* policies can be loaded at runtime. New code has to 
>> be
>> loaded into the mercury or prolog engine, and I don't want to have to
>> reload all the policies whenever a new one comes in.
>
> I'm assuming then you don't know all the policies ahead of time, and
> therefore you can't just load them all at startup.
>
> In that case you could use the code in extras/dynamic_linking which
> provides a Mercury interface to the C dlopen(), dlsym(), and dlclose()
> functions.  Of course, you'd have to make sure your policy modules
> were compiled before you dl.open'ed them.
>
> There may be other solutions, but I don't know enough about your
> application to suggest any with confidence.
>

May I suggest an alternative you may want to think about:  Define a new 
type to describe your policies, then write Mercury code to process 
values of this type.  You may find that customising the representation 
of the policies in this way allows you to control the rules that are 
allowed in policies and may also allows you to add rules that would 
otherwise be difficult to add if the policy was a prolog (or mercury) 
module.  You also then have more control of how the policies are 
interpretted which may mean they can be interpretted more efficiently.

If your policies must be logic programs, then you might want to have a 
look at samples/interpretter which is a simple interpretter for 
definite logic programs.

Ian.

--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list