# Using Quasiquotations at run time

**URL:** <https://swi-prolog.discourse.group/t/using-quasiquotations-at-run-time/5140>\
**Category:** Nice to know\
**Created:** [March 17, 2022, 2:06pm UTC](https://swi-prolog.discourse.group/t/using-quasiquotations-at-run-time/5140 "2022-03-17T14:06:41Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![ridgeworks](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/ridgeworks/32/886_2.png) [@ridgeworks](https://swi-prolog.discourse.group/u/ridgeworks)\
**Post date:** [March 17, 2022, 4:40pm UTC](https://swi-prolog.discourse.group/t/using-quasiquotations-at-run-time/5140/2 "2022-03-17T16:40:57Z")

</div>

Currently this is what is required and what I was trying to get at with this thread:

> [@Quasi-quotation API extension?](https://swi-prolog.discourse.group/t/quasi-quotation-api-extension/5060):
>
> I have to admit I don’t fully understand all the ramifications of quasi-quotations, but: The API for [quasi-quotations](https://www.swi-prolog.org/pldoc/man?section=quasiquotations) does not obviously allow for the content to be a normal string. Instead it seems to be some opaque term created by the builtin parser. Would it be possible/desirable to extend this API so either the content could be a string, or to support a predicate to convert a normal string to such an opaque term? In essence, is there a way to decouple the builtin Prolog parser from the ind…

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.,
> 
> ```prolog
> 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.

---

_[View the full topic](https://swi-prolog.discourse.group/t/using-quasiquotations-at-run-time/5140)._
