-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Checking if a predicate exists within a specific module #389
Comments
I'll have a look, obviously too lax.
…On Mon, 13 Nov 2023, 20:09 guregu, ***@***.***> wrote:
Trealla's predicate lookup will scan all loaded modules as fallback, but
is it possible to do a stricter check?
% foo.pl
:- module(foo, []).
is_foo.
% bar.pl
:- module(bar, []).
not_foo.
$ tpl foo bar?- foo:current_predicate(not_foo/0). true. % is there some check that makes this false?
I played around with hacking search_predicate to only do the global
search when q->st.m == q->pl->user_m for current_predicate/1 and it seems
to work, but I have a feeling it might break something :-)
My use case is that I have a bunch of modules that may or may not define
the same unexported predicates (something like entity definitions for a
CRUD app), and I'd like to check if a particular module defines one,
basically a crappy version of Logtalk protocols.
—
Reply to this email directly, view it on GitHub
<#389>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AFNKSEUK42LG2NAHQKWDEXLYEHWUFAVCNFSM6AAAAAA7I4PSD2VHI2DSMVQWIX3LMV43ASLTON2WKOZRHE4TAMZRHA2TQOA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
There's still work to do but as it currently stands... ~/trealla (devel) $ cat foo.pl |
Awesome, thank you. I'll play around with it tonight. |
Tried it out a bit and it looks good, thanks! |
I'm curious. Prolog modules are an evolutionary dead-end. Why try hacks around modules and spend time on crappy versions of Logtalk features when Logtalk fully supports Trealla Prolog? |
No good reason, really. Part of it is trying to understand (and improve) quirks in Trealla. Part of it is because I don't have a good way of distributing Logtalk-based programs for browsers yet (this is no fault of Logtalk). I made an issue in trealla-js, let me know if you have any ideas: guregu/trealla-js#26 |
I'm closing this. |
Thanks @infradig! |
Trealla's predicate lookup will scan all loaded modules as fallback, but is it possible to do a stricter check?
I played around with hacking
search_predicate
to only do the global search whenq->st.m == q->pl->user_m
forcurrent_predicate/1
and it seems to work, but I have a feeling it might break something :-)My use case is that I have a bunch of modules that may or may not define the same unexported predicates (something like entity definitions for a CRUD app), and I'd like to check if a particular module defines one, basically a crappy version of Logtalk protocols.
The text was updated successfully, but these errors were encountered: