From ok@atlas.otago.ac.nz  Tue Aug 22 01:00: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 BAA17702;
	Tue, 22 Aug 2000 01:00:49 +0200 (MET DST)
Received: (from ok@localhost)
	by atlas.otago.ac.nz (8.9.3/8.9.3) id LAA17961;
	Tue, 22 Aug 2000 11:01:01 +1200 (NZST)
Date: Tue, 22 Aug 2000 11:01:01 +1200 (NZST)
From: "Richard A. O'Keefe" <ok@atlas.otago.ac.nz>
Message-Id: <200008212301.LAA17961@atlas.otago.ac.nz>
To: gofreddo@ozemail.com.au, jan@swi.psy.uva.nl, prolog@swi.psy.uva.nl
Subject: Re: Why? What to do here?

	>For SWI-Prolog Version 3.3.8
	>1 ?- clause( 2<3, P).
	>ERROR: No permission to access private_procedure `(<)/2'
	>2 ?-
	>
	>What is happening?

What's happening is that the implementation of built-in predicates is
highly implementation-dependent.  Some Prologs might have "real" clauses
for them, calling primitive operations, such as
	X < Y :- 28.
Some Prologs might have "fake" clauses for them, such as
	X < Y :- X < Y.
(which would actually have worked in Quintus Prolog, although we didn't do
it that way).  Other Prologs again might have calls to foreign code,
handled just like other calls to foreign code.  And yet other Prologs might
not have anything that looks even remotely like a clause, just special code
in the compiler and different special code in the interpreter.

Even amongst DEC-10 prolog, C Prolog, and PDP-11 Prolog, written by members
of the same group at about the same time, there were such differences.

The result is that there is NOTHING a sensible Prolog program can usefully
do by trying to look at the implementation of a built-in predicate.  I'm
the one who when at Quintus decided to use 'permission error'; that has
always meant "the thing you are asking about (notionally) exists but you
aren't allowed to look at it".  In this case, "because you would not get
a meaningful answer".

A hack that would have worked for meta-circular interpreters would have
been to define
	clause(p(X1,...,Xn), true) :- p(X1,...,Xn).
for built-in predicates, but that would have been a very bad idea for
other uses of clause/2.

In retrospect, a really good hack would have been something like
	clause(p(X1,...,Xn), built_in(p(X1,...,Xn)).
for built-in predicates, but that's the path not thought of, let alone
chosen.

