On 2016-08-10, Jim Newton <
jimka...@gmail.com> wrote:
> Interesting thing about this approach seems to be that the symbols are
> determined at parse time, so *package* can be used to figure out which
Might you mean read time? "Parse" is ambiguous; a macro can parse
the argument structure, long after read time.
> package to intern the symbol into.
In fact, have you noticed how, if you don't pass a package
argument to intern, it uses the value of *package*?
A custom reader which extracts symbols within an interpolated
string literal simply has to assemble their names and
call intern. Well, not quite; it behooves such a read macro
to observe the *readtable-case*. If things are set up such that
FoO reads as the symbol "FOO", it should probably be that way in the
interpolating syntax also.
If the inner forms are delimited by something such as braces,
then all that the reader has to do is call read-delimited-list.
That is to say, given #?"whatever ${a} whatever", the ${a} part
could be handled by scanning ${, and then calling
(read-delimited-list #\} stream t). That takes care of the
*package* being used to intern the a token.
If the syntax is $(a), the (a) part can just be scanned by
a call to read, with recursive-p true.