Subject: Re: discovering a proc's definition module

From: Jan Wielemaker <[email-masked]>
Date: Mon, 21 Aug 2000 10:09:10 +0200

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