budden <budden-lisp@mail.ru> wrote:
+---------------
| 3. Reader extensions and fixes: associate readmacros with symbols, not
| only to characters. Making possible to have multiple assignments of
| e.g. #\[ readmacro at the same time and a way to switch them easily.
+---------------
Already there: You can use the "integer infix parameter" argument
of a dispatching macro character reader macro function, see CLHS
"2.1.4.4 Macro Characters" to completely change the meaning, if
you like. That is, #[...] can be totally different from #0[...],
which can be totally different from #1[...]. You could even have
the forms with supplied integer parameters set a global default
which is used by any later forms without one, so that:
#0[...] #[...] #[...] #1[...] #[...] #[...]
would mean the same as:
#0[...] #0[...] #0[...] #1[...] #1[...] #1[...]
I would not suggest doing that, though, since that would make #[...] be
"globally moded" in a way that can be very hard to read & debug later.
If you don't want to use dispatching macro characters, then you
can pull the same trick with plain macro characters, by inventing
a magic "default-switching" syntax different from any of your other
uses. E.g., if "[" is your macro character then you could easily
write [horribly confusing] stuff like this:
(defun foo (who when base)
[##SQL]
(let* (name
date
(row [select name, date from comments
where name = '$who' and date < '$when'
limit 1]))
[##PERL]
(values name [$date - $base])))
I would not suggest trying to use anything as confusing as that
for real... but one *could*...
-Rob
-----
Rob Warnock <rpw3@rpw3.org>
627 26th Avenue <URL:http://rpw3.org/>
San Mateo, CA 94403 (650)572-2607