Re: missing multifile pred
Jan Wielemaker <[email protected]>
| Newsgroups | gmane.comp.ai.prolog.swi |
|---|---|
| Message-ID | <[email protected]> |
Mostly looks ok. Also considering it fails rather than raising an
error, I'd expect there is some other problem with the code. I
see only a few small glitches, not looks fatal to me (below)
On 10/10/2013 05:54 AM, Anne Ogborn wrote:
> I continue to be baffled by the rules for defining multifile predicates.
> Here's some code
>
>
> in patterns.pl
> :- module(patterns, [traffic_pattern/3]).
>
> :- meta_predicate traffic_pattern(?, 1, ?).
>
> :- multifile patterns:traffic_pattern/3.
There is no reason to qualify this with patterns:
>
> ========== in module ttj
>
> :- use_module(patterns).
> :- use_module(logger).
Here, you officially have to repeat the multifile decl,
although SWI-Prolog doesn't mind. Here, you do have to
use the patterns: qualification.
> patterns:traffic_pattern(ttj, ttj_handler, []). <-- should be defined here
>
> ttj_handler(Request) :-
> memberchk( path('/ttj'), Request),
> general_traffic_reply_ttj(Request).
>
> =========== in module root_handler
>
> :- use_module(patterns).
>
> general_traffic(Request) :-
> traffic_pattern(Name, Handler, _), <-- never succeeds
> call(Handler, Request),
> log_traffic(Name, Request).
>
>
> One thing that puzzles me is that doing listing on traffic_pattern gives
>
> :- multifile traffic_pattern/3.
> :- meta_predicate traffic_pattern(?,1,?).
>
> traffic_pattern(ttj, ttj_handler, []).
>
> so it's there, why am I not finding it?
If there is no error, I'd first try tracing to see whether
the arguments are what you think they are, there is no stupid
typo, etc.
Cheers --- Jan
>
> (guessing I'm in module hell again, but baffled)
> _______________________________________________
> SWI-Prolog mailing list
> [email protected]
> https://lists.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog
>