-
Notifications
You must be signed in to change notification settings - Fork 151
Document listing/1 #2929
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
base: master
Are you sure you want to change the base?
Document listing/1 #2929
Conversation
Thank you a lot for working on this! I think an important point to state in the documentation is that the predicate must be public so that its body can be inspected at all. One way to make a predicate public is to declare it as dynamic, using the |
Clarify what happens if no clauses make it more obvious that pred must be "dynamic"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A predicate without clauses that has been declared as dynamic must not fail in listing. That is the behavior in SICStus.
Also note that author intends to "apply Cunnigham's law" that is to produce incorrect answers on purpose!
That’s what the current predicate does so I was documenting per implementation. It would indeed be a good idea to align the behavior with other systems. edit: I misremembered. SWI succeeds but shows a comment-like message for procedures implemented in native code. I'm not sure if SWI even has private procedures.
I don't love this, but it seems better than an error if you try to list a whole module that re-exports a private procedure.
Believe me, I’m quite good at being wrong without trying to! |
I can't find this in the SICStus documentation and don't have a license to try it myself. What's the behavior in SICStus's
|
You can get a free evaluation licence of SICStus! A predicate that fails can be easily emitted as |
A predicate that fails is similar but not identical to a predicate with no clauses. |
It seems that, on SICStus, the behavior is substantially different. It doesn't print anything for a dynamic predicate with no clauses, and even succeeds when called on a built-in predicate!
Expecting the behavior of SICStus seems to be setting yourself up for disappointment. |
Many errors are issued in SICStus via messages. That is warnings. That's what you got. Scryer is more restrictive issuing directly errors. |
If I'm understanding correctly, the purpose of
@triska, @UWN, which is closer to the vision you have in mind for what These use cases imply different, conflicting behaviors and I think that's why this method NEEDS documentation. I'll be happy to rewrite the procedure and the documentation to match. |
IMHO For example: :- dynamic(a/2).
a --> "a". And then the query:
|
@hurufu Don't quote me on this, but I think the intent is to be able to declare such a nonterminal with Anyway, what's your desired output (even if it might be impossible to make happen at this time)? Current output:
1:
2:
3:
Would you expect to see the |
@rotu I would vote for 1st variant, but my comment wasn't about expected behavior, but about that |
fix #2923