ciao-lang / ciao

Ciao is a modern Prolog implementation that builds up from a logic-based simple kernel designed to be portable, extensible, and modular.
https://ciao-lang.org
GNU Lesser General Public License v3.0
268 stars 20 forks source link

ISO core standard compatibility of Ciao WASM #53

Closed Jean-Luc-Picard-2021 closed 2 years ago

Jean-Luc-Picard-2021 commented 2 years ago

Now I bumped my head:

For the later I get:

?- current_prolog_flag(version, X).
WARNING: Predicate current_prolog_flag/2 undefined in module ciaowasm
{ERROR: No handle found for thrown exception 
error(existence_error(procedure,'ciaowasm:current_prolog_flag'/2),
'ciaowasm:current_prolog_flag'/2)}

Although "version" is not some standard flag, but current_prolog_flag/2 is ISO core standard, isn't it? How do I obtain the version of the Ciao WASM I am using. "version", "dialect" and "version_data" Prolog flags are

meanwhile widespread. Is there some equivalent to obtain similar data in Ciao Prolog. Maybe this can be mapped to ISO core standard current_prolog_flag/2 built-in predicate?

jfmc commented 2 years ago

Somehow the predicates to access prolog flags is not imported in the toplevel by default. It can be done with:

?- use_module(engine(runtime_control)).

We'll fix that as soon as possible. Then you can use version, dialect, and version_data:

?- current_prolog_flag(version_data,X), writeq(X), nl.
ciao(1,21,0,commit_info('',ea466db6e04b0813271351c6c134ab96ff31d5da,'2022-07-05 00:13:44 +0200','1.21.0'))

Note that atoms are still not quoted properly in the output. We'll fix that soon too.

I am not sure if there is any widespread or standard way of asking the current architecture and operating system. We do it in Ciao in this way:

?- use_module(engine(system_info)).
?- get_os(OS).
?- get_arch(Arch).

(note again that atoms are not quoted properly in the output).

Many ISO compatibility bugs (mostly identified by Paulo Moura) has been in the bug queue for a long time and we plan to fix them soon too. Feedback on most urgent issues is really appreciated.

Jean-Luc-Picard-2021 commented 2 years ago

Don't worry. Especially when issues land on GitHub, they can queue for years. Its rather a curse than a cure.

Some statistics:

I cannot describe the issueless approach exactly. Maybe it doesn't work for existing systems that are already large.

jfmc commented 2 years ago

I'm closing this issue. 307815b8b0e63320ab91c7d7615573e3d5d7b512 should fixes everything except div/2 (#35)