Newsgroups: comp.lang.prolog
Path: cantaloupe.srv.cs.cmu.edu!rochester!cornellcs!newsstand.cit.cornell.edu!news.kei.com!newsfeed.internetmci.com!newsxfer2.itd.umich.edu!agate!ihnp4.ucsd.edu!munnari.OZ.AU!cs.mu.OZ.AU!fjh
From: fjh@cs.mu.OZ.AU (Fergus Henderson)
Subject: Re: quintus prolog question about modules and database references
Message-ID: <9536115.17953@mulga.cs.mu.OZ.AU>
Organization: Computer Science, University of Melbourne, Australia
References: <CEH.95Dec20085015@medusa.sce.carleton.ca>
Date: Wed, 27 Dec 1995 04:11:17 GMT
Lines: 32

ceh@medusa.sce.carleton.ca (Curtis Hrischuk) writes:

>Hi.  I am having a difficult time understanding the Quintus Prolog
>usage of modules (i.e. I am very frustrated by their concept).  

I think your problem is not with modules, but simply that you have
misinterpreted an error message.

>The difficulty is that a goal in tools.pl attempts to access a database
>reference for a fact in file testfile.pl.  This goal (in tools.pl)
>uses the predicate clause/3 which returns the database reference as
>the last paramater.  When I try to execute this statement I get the
>following error:
>
>! Permission error: cannot access clauses of compiled user:rnv/4
>! goal:  clause(user:rnv(thread1,[r,3,none],[t,client,1,3],[d,send]),true,_7507)
>
>It would appear that my facts from testfile have been read into module
>'user'.  It would also appear that my goal (in tools.pl) has been read
>into a separate module which is not allowed to access the 'user'
>facts.

No, the explanation is much simpler.  `clause/3' cannot be used to
access clauses of compiled predicates.  If you want to use `clause/3'
for a predicate, you must explicitly declare that predicate as `dynamic',
using a declaration such as

	:- dynamic rnv/4.

--
Fergus Henderson             	WWW: http://www.cs.mu.oz.au/~fjh
fjh@cs.mu.oz.au              	PGP: finger fjh@128.250.37.3
