From jan@swi.psy.uva.nl  Mon Aug 21 10:14:43 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 KAA26281;
	Mon, 21 Aug 2000 10:14:38 +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 KAA02842;
	Mon, 21 Aug 2000 10:14:56 +0200
From: Jan Wielemaker <jan@swi.psy.uva.nl>
Organization: SWI, University of Amsterdam
To: Paul Singleton <p.singleton@keele.ac.uk>,
        SWI Prolog <prolog@swi.psy.uva.nl>
Subject: Re: discovering a proc's definition module
Date: Mon, 21 Aug 2000 10:09:10 +0200
X-Mailer: KMail [version 1.0.28]
Content-Type: text/plain
References: <399D6B92.844E819A@keele.ac.uk>
In-Reply-To: <399D6B92.844E819A@keele.ac.uk>
MIME-Version: 1.0
Message-Id: <00082110145602.02738@gollem>
Content-Transfer-Encoding: 8bit

On Fri, 18 Aug 2000, Paul Singleton wrote:
>Can a module export a proc it imports?

Yes

>  ?- predicate_property(some_proc(_,_), imported_from(Module)).
>
>always tell me the module in which some_proc/2 is actually *defined*?

Yes.  Even if it was exported twice it actually tells you where it
is really defined.

>If not, how do I:
>
> * discover the definition module of any accessible proc?
>
> * enumerate the procs defined in a given module?

procs_in_module(M) :-
	current_predicate(_, M:Head),
	\+ predicate_property(M:Head, imported_from(_)).

>(I can see how to: enumerate all modules; enumerate their exports;
>enumerate all foreign libraries, the procs they provide, and the
>modules in which they appear to provide them, but I'm missing something
>w.r.t. native procedures.)

There's a lot of that junk in library(sqave), defining qsave_program/2,
which is mostly written in Prolog.

	Regards --- Jan

