Newsgroups: comp.lang.prolog
Path: cantaloupe.srv.cs.cmu.edu!bb3.andrew.cmu.edu!nntp.sei.cmu.edu!cis.ohio-state.edu!math.ohio-state.edu!howland.reston.ans.net!torn!nott!cunews!bertrand!ceh
From: ceh@medusa.sce.carleton.ca (Curtis Hrischuk)
Subject: quintus prolog question about modules and database references
X-Nntp-Posting-Host: medusa.sce.carleton.ca
Message-ID: <CEH.95Dec20085015@medusa.sce.carleton.ca>
Sender: news@cunews.carleton.ca (News Administrator)
Organization: Carleton Univeristy, Systems & Computer Eng. Dept.
Date: Wed, 20 Dec 1995 13:50:15 GMT
Lines: 45

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

Like a good software engineer I have segmented my prolog code into
several files, where each file is considered to be a module.  I have
also separated my facts into different files based on the tests I wish
to run.  The basic operation of the code is:

aTest :-
	reconsult(testfile),	% load the facts from testfile.pl
	reconsult(tools),       % load the prolog code in file tools.pl
	reconsult(filegoals),   % load the prolog code in filegoals.pl
	doFileGoals,            % analyze the facts
	write('Test success').

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.

I have read the Quintus documentation regarding modules and I think I
understand it.  I have tried every combination of factors I can think
of to get around this, without success.  What is the proper way to get
around this?

Thank you for your time.

Curtis
-- 
-------------------------------------------------------------------------------
| Curtis Hrischuk (PhD Cand)  | Boundaries of Science:                        |
| ceh@sce.carleton.ca         | 1) How did I get here?                        |
| Carleton University         | 2) Why am I here?                             |
| Ottawa, On. ,Canada, K1S-5B6| 3) What happens when I leave?                 |
| Ph  (613) 788-2600 x1762    | "The proof is almost identical to the previous|
| FAX (613) 788-5727          | proof and hence omitted here."(actual quote)  |
