From ok@atlas.otago.ac.nz  Tue May 16 03:11:51 2000
Received: from atlas.otago.ac.nz (atlas.otago.ac.nz [139.80.32.250])
	by swi.psy.uva.nl (8.9.3/8.9.3) with ESMTP id DAA08174
	for <prolog@swi.psy.uva.nl>; Tue, 16 May 2000 03:11:50 +0200 (MET DST)
Received: (from ok@localhost)
	by atlas.otago.ac.nz (8.9.3/8.9.3) id NAA15395;
	Tue, 16 May 2000 13:12:00 +1200 (NZST)
Date: Tue, 16 May 2000 13:12:00 +1200 (NZST)
From: "Richard A. O'Keefe" <ok@atlas.otago.ac.nz>
Message-Id: <200005160112.NAA15395@atlas.otago.ac.nz>
To: D.N.Davis@dcs.hull.ac.uk, prolog@swi.psy.uva.nl
Subject: Re:  Static and Dynamic Prolog clauses

Darryl Davis <D.N.Davis@dcs.hull.ac.uk> wrote
	 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.
	
So does Quintus Prolog.
From the Quintus Prolog 3.0 manual, section F.15-2-1: assert(+Clause)

	If there is a static definition for the specified predicate,
	then assert/1 fails, an error message is sent to the standard
	error stream, and the system enters the debugger in trace mode.

From section F.15-4: clause(+Head, ?Body)

	If the principal functor of Head is (sic.) a static predicate,
	clause/2 fails, an error message is sent ot the standard error
	stream, and the system enters the debugger in trace mode.
	
	 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'
	
As well it should!

	Any suggestions as to work-around this.

(A) Ask the authors to fix their code.
(B) Declare the predicate :-dynamic.
(C) Split the predicate into two predicates:  a static part and a
    dynamic part.  Change all the asserts to modify the dynamic part.

	It seems like a reasonable thing to do in prolog
	
Not really, no.  There are good reasons for distinguishing dynamic from
static code.  Trying to mix them in one predicate is asking for trouble.

