A quasiquote is not a block (even if the delimiters are curlies),
so any declaration of a variable is taken to be part of the block
surrounding the macro call location. Add your own {...} if you want
a block to surround your declarations.
I read this as meaning that
macro M () { return q:code { my $x } };
would add a lexical $x to the scope of M's caller. This seems unhygienic
and against the spirit of the "my $COMPILING::x" in earlier versions of S06.
Regardless of the "not a block" status of a q:code, I think that it's
lexicals should only be visible within the q:code by default. If this is
the intention of the above phrase the it should be made clearer.
Brad
--
... There is dignity in paucity of words. ... -- Hagakure
Indeed the design is intentionally unhygienic; I couldn't find an easy
way for default-hygienic to turn into unhygienic (we do need unhygienic
macros sometimes), and there's a very easy way to turn
default-unhygienic to hygienic ones (just add another pair of curlies).
I'm not particularly happy with this; another thought is for q:code to
be hygienic by default, but introduce a q:code(:no_scope) or
q:code(:leak) or q:code(:unhygienic) or some other flag to remove the
implicit scoping. Would that be a saner default? :-)
Audrey
Maybe that's what q:code(:COMPILING) actually does? Or has as an
additional side effect? Hmm...
Larry