develooper Front page | perl.perl6.language | Postings from March 2002

Re: Topicalizers: Why does when's EXPR pay attention to topicaliz er r egardless of associated variable?

Thread Previous | Thread Next
From:
Allison Randal
Date:
March 21, 2002 09:52
Subject:
Re: Topicalizers: Why does when's EXPR pay attention to topicaliz er r egardless of associated variable?
Message ID:
20020321175231.GA23809@shadowed.net
On Wed, Mar 20, 2002 at 09:59:35AM -0800, Larry Wall wrote:
> 
> I should update y'all to my current thinking, which is that $_ is
> always identical to the current topic, even if the topic is aliased to
> some other variable. To get at an outer topic, you'd have to use the
> same mechanism we'll use for redeclared lexicals:
> 
>     my $foo = $OUTER::foo;
> 
>     for @x {			# aliases $_
> 	for @y -> $y {		# aliases both $x and $_
> 	    print $OUTER::_;
> 	}
>     }

I rather like this compromise. It provides the desired behaviour of
"always default to the current topic" and so eliminates the confusion
between C<when> and other defaulting constructs. It also maintains the
"$_ is default" concept, which is quite important to people, as earlier
bits of this thread demonstrated. 

Allison

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About