mthom / scryer-prolog

A modern Prolog implementation written mostly in Rust.
BSD 3-Clause "New" or "Revised" License
2.07k stars 123 forks source link

Blackboard predicates are not module sensitive on key, as Sicstus, SWI & Yap are #2421

Open infradig opened 5 months ago

infradig commented 5 months ago
$ cat m1.pl
:- module(m1, [f/0]).
:- use_module(library(iso_ext)).

f :- bb_put(abc, 456).

$ cat m2.pl
:- module(m2, [g/0]).
:- use_module(library(iso_ext)).

g :- bb_put(abc, 123).

$ scryer-prolog 
?- use_module('m1').
   true.
?- use_module('m2').
   true.
?- m1:f.
   true.
?- m2:g.
   true.
?- m1:bb_get(abc, V).
   V = 123.
?- m2:bb_get(abc, V).
   V = 123.
?- bb_get(abc, V).
   V = 123.

I know the docs say it is a global key, but it's incompatible with the other systems.

infradig commented 5 months ago

From what I can tell, tabling seems to require that the blackboard is global. This is odd as I believe tabling module came from SWI (before it was replaced there) and the blackboard is not currently global there.