Skip to content
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

Feature request flag dialect, maybe version and version_data #1017

Closed
ghost opened this issue Aug 9, 2021 · 2 comments
Closed

Feature request flag dialect, maybe version and version_data #1017

ghost opened this issue Aug 9, 2021 · 2 comments

Comments

@ghost
Copy link

ghost commented Aug 9, 2021

It seems that scryer prolog has very few Prolog flags:

?- current_prolog_flag(X,Y), write(X-Y), nl, fail; true.
bounded-false
integer_rounding_function-toward_zero
double_quotes-chars
   true.

I am not drumming the ISO core standard drums. I rather observed
that many Prolog systems support the Prolog flag "dialect". Then some
Prolog system also support the Prolog flags "version" and "version_data".

Here is an example from SWI-Prolog:

?- current_prolog_flag(dialect, X).
X = swi.
?- current_prolog_flag(version, X).
X = 80326.
?- current_prolog_flag(version_data, X).
X = swi(8, 3, 26, []).

Would it be possible to add these to Scryer Prolog?

@ghost ghost changed the title Feature request prolog flag dialect, maybe version and version_data Feature request flag dialect, maybe version and version_data Aug 9, 2021
@aarroyoc
Copy link
Sponsor Contributor

aarroyoc commented Aug 9, 2021

If I remember correctly this was already suggested in #511 and #84. I don't think there is a technical blocker but there are some arguments that is better to not let the programs know which Prolog implementation are they running to encourage standards conformance.

IMO +1 to add them, it could be useful for reporting

@triska
Copy link
Contributor

triska commented Aug 9, 2021

The notion of "dialect" is alien to the Prolog standard, although it recognizes different levels of conformance to the standard.

You can get the Scryer Prolog version with the internal predicet '$scryer_prolog_version'/1:

v(V) :- '$scryer_prolog_version'(V).

yielding:

?- v(V).
   V = "v0.8.123-596-g72a77 ...".

A better way is to use the -v command line switch:

$ scryer-prolog -v
"v0.8.123-596-g72a7765-modified"

It is bad practice to make code dependent on any specific system: Better test for features such as the existence of predicates, since new Prolog systems that provide these features will then automatically also be supported. You can also add compatibility features you need in your ~/.scryerrc configuration file so that they are loaded on startup, or in a file, say scryer_specific_definitions.pl, and then load that.

@ghost ghost closed this as completed Aug 9, 2021
@ghost ghost reopened this Aug 9, 2021
@ghost ghost closed this as completed Oct 24, 2021
This issue was closed.
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