Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

S06 Splicing clarification

0 views
Skip to first unread message

Brad Bowman

unread,
Mar 10, 2006, 8:24:48 AM3/10/06
to perl6language,

S06/Splicing finishes with:

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

Audrey Tang

unread,
Mar 10, 2006, 2:40:59 PM3/10/06
to Brad Bowman, perl6language,
Brad Bowman wrote:
> 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.

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

signature.asc

Larry Wall

unread,
Mar 10, 2006, 2:50:04 PM3/10/06
to perl6language,

Maybe that's what q:code(:COMPILING) actually does? Or has as an
additional side effect? Hmm...

Larry

0 new messages