Using SWI-Prolog 7.1 or later:
?- pack_install('https://github.com/TeamSPoon/gvar_syntax.git').
Source code available and pull requests accepted at http://github.com/TeamSPoon/gvar_syntax
?- use_module(library(gvar_syntax)). true. ?- $foo.value = 1. true. ?- $foo.value = 2. false. ?- writeln($foo.value). 1 true. ?- writeln($foo.get()). 1 true. ?- $foo.clear(). true. ?- writeln($foo.value). _8350 ?- writeln($bar.set(2).value). 2 ?- $foo.value = yyyyyyy. true. ?- $baz.set(point{ x: ($foo.get()) , y:vy, z:vz}). true. ?- writeln($baz.value.x). yyyyyyy true.
How does it interact with modules?
That is, are your $foo variables in a truly global space?
You could either do
$module:foo.get()
or
be outside the normal module space and be
$namespace$sub_namespace$foo.get()
where you can have an arbitrary nesting of subnamespaces.
>If I should build that upon Logtalk or not. Currently its built upon SWICLI, JPL, Attvars and Dicts.
Any of those are, IMHO, too much coupling.
I don't want to drag in all of logtalk or swicli just to get your pack!