From jan@swi.psy.uva.nl  Tue May 16 10:39:47 2000
Received: from gollem.swi.psy.uva.nl (root@gollem [145.18.152.30])
	by swi.psy.uva.nl (8.9.3/8.9.3) with ESMTP id KAA22091;
	Tue, 16 May 2000 10:39:47 +0200 (MET DST)
Received: from localhost (localhost [[UNIX: localhost]])
	by gollem.swi.psy.uva.nl (8.9.3/8.9.3/SuSE Linux 8.9.3-0.1) id KAA00434;
	Tue, 16 May 2000 10:39:51 +0200
From: Jan Wielemaker <jan@swi.psy.uva.nl>
Organization: SWI, University of Amsterdam
To: Darryl Davis <D.N.Davis@dcs.hull.ac.uk>, prolog@swi.psy.uva.nl
Subject: Re: Static and Dynamic Prolog clauses
Date: Tue, 16 May 2000 10:36:36 +0200
X-Mailer: KMail [version 1.0.28]
Content-Type: text/plain
References: <E12rQVe-0005MV-00@scarlet.dcs.hull.ac.uk>
In-Reply-To: <E12rQVe-0005MV-00@scarlet.dcs.hull.ac.uk>
MIME-Version: 1.0
Message-Id: <00051610395100.00382@gollem>
Content-Transfer-Encoding: 8bit

On Mon, 15 May 2000, Darryl Davis wrote:
>Hi
>
> I have a slight problem with SWI-v3.3.6 and the use of 'assert'.
> In some code from another academic institution (which runs under
>	Quintus) there are static definitions for a relation
>	and dynamic additions through the use of assert at run-time.
> v3.3.6 complains about this.
>
> E.g.
>    ?- listing(next_episode).
>
>    next_episode(A, B) :-
>        clause(next_episode(A, B), !), !.
>    next_episode(A, B) :-
>        following(A, B).
>
>    Yes
>    ?- assert(next_episode(t5,t4)).
>    ERROR: No permission to modify static_procedure `next_episode/2'
>
>Any suggestions as to work-around this. It seems like a reasonable 
>thing to do in prolog

No, it's not.  This holds for Quintus too, unless the code was compiled
with the `all-dynamic' option.  Simply add

	:- dynamic
		next_episode/2.

before the definition of next_episode/2.  (actually after works too,
but that is not according to the standard and might change someday).

	Regards --- Jan

P.s.	These two clauses look pretty suspicious ...

