Quasiquoations are almost always converted at compile time. However there are some times when being able to convert a quasiquotation at run time is useful.
This test case shows how.
Quasiquoations are almost always converted at compile time. However there are some times when being able to convert a quasiquotation at run time is useful.
This test case shows how.
Currently this is what is required and what I was trying to get at with this thread:
The reason for this is that the QQ content is at the Prolog level is an opaque term containing a pointer to memory. It would be nice to have a runtime API that didn’t require you to construct a string in qq format and then run it back through the parser which is somewhat wasteful.
One possibility is to define an additional multifile QQ API predicate, e.g.,
qq_parse(+Syntax,+String,+VariableNames,-Result).
Note that this doesn’t require any changes to the current implementation; it just standardizes a way for QQ implementations to support runtime evaluation if they so choose.