Processing text (such as SQL)
A percent sign indicates that the following identifier is the name of a macro function.
A list is constructed within curly braces.
List elements are separated by the hash symbol
The quote makes sure that the following special character (%
, {
and #
) are not immediatly evaluated.
Everything else is «text».
select %cols{foo # bar # baz} …
How should foreach be implemented?
Nested invocation of macros:
%mac-one{ %mac-two{arg-1 # arg-2 } # arg-3 }
Read-eval-print loop (REPL)
If used in an SQL shell (such as Oracle's SQL Developer or the SQLite shell), executing SQL statements is a basic form of a read-eval-print loop. Missing is a convenient way to store the result of a select statement or even use the result within a function call.
A macro language should provide such a feature.