In a message dated Fri, 12 Apr 2002, Glenn Linderman writes:
> $_ becomes lexical
> $_ gets aliased to the first topic of a given clause (hence changes
> value more often, but the lexical scoping helps reduce that impact)

Okay.  But it sounds like you're saying that C<given>, and C<given> only,
introduces a topic, and that can't be right.  From Ex4:

"This is a fundamental change from Perl 5, where $_ was only aliased to
the current topic in a for loop. In Perl 6, the current topic -- whatever
its name and however you make it the topic -- is always aliased to $_."

And later:

"In a Perl 6 method, the invocant (i.e. the first argument of the method,
which is a reference to the object on which the method was invoked) is
always the topic...."

And obviously a C<CATCH> block introduces a topic (though I guess we
can pretend that C<CATCH> is a special kind of C<given>).

So I had (wrongly, I guess?) extended this logic to: "all blocks taking
parameters introduce a topic, which is the first parameter".  Which made
me think that C<sub> blocks, too, introduce a topic, which would be
equivalent to @_[0].

So where did I go wrong?

Trey


Reply via email to