Just notice I made a big mistake, or maybe not? I used the following
syntax for reference data type in Prolog:
reference :== "0" "r" name .
Isn’t this in conflict to rational numbers syntax:
rational :== integer "r" integer .
Not really a rational number would have a digit after “r”, whereas
a reference data type wouldn’t have a digit after the “r”.
Now I can input output the beasts on JavaScript and Python,
and even sorting them now works:
?- sort([1,0rFalse,3.14,0rNone], L).
L = [3.14, 1, 0rNone, 0rFalse].
?- compound(0rTrue).
fail.
?- reference(0rTrue).
true.
Edit 16.03.2023
Will also bring them to Java. Although JPL proposes @(null)
,
@(false)
and @(true)
? But the advantage of the 0r
syntax,
it gives a data type, which is not a compound.
Motivation to introduce these constants. JavaScript wanted
me a boolean attribute value for the attribute name “disabled”
on a DOM element. But I guess another application area
would be JSON parsing and unparsing.