Okay, first thing to keep in mind, this hasn't been finally-finalized yet. Alot was hashed out in the process of proofing E4, but there will be more to come.
On Fri, Apr 12, 2002 at 07:39:17PM -0400, Trey Harris wrote: > 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: You are correct, C<given> is not the only topicalizer. C<for> is too, and ->, etc... > "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 $_." You could really say topic is just another name for $_. > "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...." Emphasis on "method". > 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>). Yes. > 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]. Sound logic. And it almost did go that way. But subs that access the current $_ directly are far too common, and far to useful. (Drat! Now I have to leave for several hours, just when it's getting interesting...) Allison