Skip to content

meta_predicate doesn't accept predicate indicator sequence nor list #2444

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

Open
hurufu opened this issue Jul 7, 2024 · 3 comments
Open

meta_predicate doesn't accept predicate indicator sequence nor list #2444

hurufu opened this issue Jul 7, 2024 · 3 comments

Comments

@hurufu
Copy link
Contributor

hurufu commented Jul 7, 2024

In order to maintain compatibility with SICStus which was discovered while trying to run original reif.pl implementation, it looks like meta_predicate directive should be extended to accept predicate indicator sequence and list (similar to #1586).

I've tried to do it myself, but code for registering meta-predicate records differs from other directives quite significantly that I couldn't just copy/adapt code from others.

@hurufu
Copy link
Contributor Author

hurufu commented Jul 12, 2024

Relevant task: #1302, and commit a4d15bf.

hurufu added a commit to hurufu/scryer-prolog that referenced this issue Jul 19, 2024
  * predicate_property/2 removed, because it isn't working (mthom#2443)
  * meta_predicate instruction was split (mthom#2444)
  * Few changes were adopted from SWI variant[1], because it has
    similar handling of (:)/2 with predicates in modules.
  * Scryer specific changes

[1]: http://www.complang.tuwien.ac.at/ulrich/Prolog-inedit/swi/reif.pl
hurufu added a commit to hurufu/scryer-prolog that referenced this issue Aug 24, 2024
  * predicate_property/2 removed, because it isn't working (mthom#2443)
  * meta_predicate instruction was split (mthom#2444)
  * Few changes were adopted from SWI variant[1], because it has
    similar handling of (:)/2 with predicates in modules.
  * Scryer specific changes

[1]: http://www.complang.tuwien.ac.at/ulrich/Prolog-inedit/swi/reif.pl
@Skgland
Copy link
Contributor

Skgland commented Aug 27, 2024

op/3 are handled in the toplevel https://github.com/mthom/scryer-prolog/blob/master/src/toplevel.pl#L171-L179 turning the declaration using a list into individual declarations.
Wouldn't that work analog for meta_predicate ? I.e.

user:term_expansion((:- meta_predicate(Metas)), MetaResults) :- 
    ground(Metas), 
    Metas= [Meta| OtherMetas],
    expand_meta_list([Meta| OtherMetas], MetaResults).

expand_meta_list([], _, _, []).
expand_meta_list([Meta| OtherMetas], [(:- meta_predicate(Meta)) | OtherResults]) :-
    expand_meta_list(OtherMetas, OtherResults).

@hurufu
Copy link
Contributor Author

hurufu commented Aug 27, 2024

Ineteresting idea, I initially thought to add two more instructions to dispatch.rs: CallAddMetaPredicateRecord, ExecuteAddMetaPredicateRecord and then handle it in loader.rs by calling loader.add_meta_predicate_record(...). But I never finished that code.

UPDT: Also I'm not sure, but it looks like meta_predicate handling is done during preprocessing stage, ie before goal expansion.

hurufu added a commit to hurufu/scryer-prolog that referenced this issue Jan 2, 2025
  * predicate_property/2 removed, because it isn't working (mthom#2443)
  * meta_predicate instruction was split (mthom#2444)
  * Few changes were adopted from SWI variant[1], because it has
    similar handling of (:)/2 with predicates in modules.
  * Scryer specific changes

[1]: http://www.complang.tuwien.ac.at/ulrich/Prolog-inedit/swi/reif.pl
hurufu added a commit to hurufu/scryer-prolog that referenced this issue Jan 3, 2025
  * predicate_property/2 removed, because it isn't working (mthom#2443)
  * meta_predicate instruction was split (mthom#2444)
  * Few changes were adopted from SWI variant[1], because it has
    similar handling of (:)/2 with predicates in modules.
  * Scryer specific changes

[1]: http://www.complang.tuwien.ac.at/ulrich/Prolog-inedit/swi/reif.pl
hurufu added a commit to hurufu/scryer-prolog that referenced this issue Jan 5, 2025
  * predicate_property/2 removed, because it isn't working (mthom#2443)
  * meta_predicate instruction was split (mthom#2444)
  * Few changes were adopted from SWI variant[1], because it has
    similar handling of (:)/2 with predicates in modules.
  * Scryer specific changes

[1]: http://www.complang.tuwien.ac.at/ulrich/Prolog-inedit/swi/reif.pl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants