scryer-prolog icon indicating copy to clipboard operation
scryer-prolog copied to clipboard

dynamic is not documented in Scryer documentation.

Open dougransom opened this issue 4 months ago • 3 comments

Prolog examples all over the internet, or generated with tools like CoPilot, use something like:

:- dynamic foo/1..

to declare dynamic predicates.

Apparently that is not ISO compliant and a source of confusion. https://github.com/mthom/scryer-prolog/issues/3068 and https://github.com/mthom/scryer-prolog/issues/178.

There is no reference to this predicate in the Scryer documentation , so a naïve programmer may just look at documentation from other systems, leading to a lot of confusion and time spent.

Ideally the documentation should say the forms that are supported, and that scryer does not support forms like the operator notation. That will make it clear and help with AI-assisted coding.

dougransom avatar Aug 29 '25 00:08 dougransom

You can add a dynamic operator if you find it more readable into your ~/.scryerrc file:

:- op(1150, fx, dynamic).

It isn't just enabled by default, because it is a non-standard extension.

But some documentation would always be nice to have, I agree.

hurufu avatar Aug 29 '25 05:08 hurufu

There is already an issue somewhere about builtins not being documented. This issue might help someone figure out their own problem in the future.

dougransom avatar Aug 29 '25 16:08 dougransom

Declaring high-priority prefix operators with names that make sense in other contexts leads to "a lot of confusion and time spent" and in a much more harmful way than the instantaneous error you received.

Consider the term [dynamic-static]. which in Scryer (and ISO/IEC) is (a list with) a pair of the two atoms (as element). Now, if you add dynamic as a prefix operator (as was suggested), you get a syntax error. How to fix that? You have a 50% chance to fix it incorrectly. You may say either [(dynamic-static)]. or [(dynamic)-static]. Both make the syntax error go away. Which one do you choose?

Now, you might turn to "other systems" and realize that many of them offer dynamic as prefix and accept [dynamic-static]. as valid syntax. How convenient! The trouble is, those that accept it do it differently, see s#92 where another high-priority prefix operator is used. And again, you probably would not have the patience to go through all systems to understand that this might be a problem.

So now compare all this to the instant feedback Scryer provided. And it is not the first system to do so, also GNU does not have these prefix operators.

Many of the (so far) 345 test cases show similar problems some of which were even related to diligence deliberations.

Do you expect that Scryer documents all of these? Just because you used an LLM with a malaprop training set? Just prompt

Write in Prolog append3/4 using append/3.

(The funniest response came from Grok, which after insisting that its answer was bad, referred to the internet, even found a page that answered this correctly, but still was not able to give the right answer.)

UWN avatar Aug 30 '25 08:08 UWN