Very cool!
One issue that I found is that library(macros)
seems to conflict with library(clpfd)
with set_prolog_flag(clpfd_monotonic, true)
, where CLP(FD) also relies on #/1
terms.
This is a bit of an edge case, but for example, if we have in macros_test.pl
:
:- module(macros_test, [baz/1]).
:- use_module(library(clpfd)).
:- set_prolog_flag(clpfd_monotonic, true).
:- use_module(library(macros)).
#define(foo, bar).
baz(X) :- #(X) #= 1 + 2.
Then trying to load this file yields an instantiation error:
$ swipl macros_test.pl
ERROR: .../macros_test.pl:11:
ERROR: Arguments are not sufficiently instantiated
ERROR: Exported procedure macros_test:baz/1 is not defined
Welcome to SWI-Prolog (threaded, 64 bits, version 9.1.10-9-g1dd0edbaa)