It's amazing what a night will do. See bottom.
--- Allison Randal [EMAIL PROTECTED] wrote:
On Tue, Feb 26, 2002 at 02:20:48PM -0800, Brent Dax wrote:
Austin Hastings:
#
# Which, then, would you like:
#
# To implicitly localize $_, losing access to an outer version,
# or to have to
From: Austin Hastings [mailto:[EMAIL PROTECTED]]
for @A {
for @B - $x {
when /a/ $_ - $a { s/a/b/; ... $a ...; }
}
}
Once we get inside the curlies, $_ is aliased to the localized var for
the Cwhen (in this case, $x).
I went back and read the Apocolypse 4: RFC 022. I may even
Larry Wall wrote:
I think the switch statement will have to recognize any
Class::Name known at compile time, and force it to call
$!.isa(Class::Name).
Don't you mean the case/when statement? Wouldn't you want the following to
work:
for @obj {
when Dog { ... }
when Cat { ... }
}
--- Larry Wall [EMAIL PROTECTED] wrote:
[EMAIL PROTECTED] writes:
: More questions on downwards binding,
:
: for @foo - $a, $b { # two at a time
: ...
: }
:
: Interpretation #1:
: for @foo[0..$foo:2] - $a,
: @foo[1..$foo:2] - $b
: { ... }
:
:
Larry Wall in Apocalypse 4 writes:
this special rule only applies to constructs that take a
block (that is, a closure) as their last (or only) argument.
Operators like sort and map are unaffected. However, certain
constructs that used to be in the statement class may become
expression
From: Garrett Goebel [mailto:[EMAIL PROTECTED]]
Speaking of which, you forgot your trailing semicolon for the
Cwhen expression's final closure/block.
s/expression/statement/
--- Garrett Goebel [EMAIL PROTECTED] wrote:
Larry Wall wrote:
I think the switch statement will have to recognize any
Class::Name known at compile time, and force it to call
$!.isa(Class::Name).
Don't you mean the case/when statement? Wouldn't you want the
following to
work:
for
--- Austin Hastings [EMAIL PROTECTED] wrote:
--- Garrett Goebel [EMAIL PROTECTED] wrote:
Larry Wall wrote:
I think the switch statement will have to recognize any
Class::Name known at compile time, and force it to call
$!.isa(Class::Name).
Don't you mean the case/when statement?
On Wed, Feb 27, 2002 at 08:02:08AM -0800, Austin Hastings wrote:
BTW, Cfor doesn't alias $_ always. That's why things like the example
below are possible.
Yes. Cfor and Cgiven will only alias $_ when they are not aliasing a
named variable.
Hmm. Suppose we force Cwhen to alias $_, but give
--- Garrett Goebel [EMAIL PROTECTED] wrote:
Speaking of which, you forgot your trailing semicolon
for the Cwhen expression's final closure/block.
I'll claim that when, like if, shouldn't need one. (I'd also normally
use multiple lines, but I'm trying to conserve newlines... :-)
Why does
On Wed, Feb 27, 2002 at 10:32:24AM -0600, Garrett Goebel wrote:
Why does Cwhen's EXPR pay attention to the topicalizer regardless of
associated variable?
Why introduce the special case? Especially when consistency and
simplification seem to be a strong undercurrent in Perl6? I'm curious
--- Allison Randal [EMAIL PROTECTED] wrote:
I'm still not convinced of your basic point, that it would be a good
thing to have Cwhen aliasing $_. Variations on whether it does it
automatically or at my request and how don't change the fundamental
concept. Cwhen is a conditional like Cif, not
Garrett Goebel:
# Larry Wall in Apocalypse 4 writes:
# this special rule only applies to constructs that take a
# block (that is, a closure) as their last (or only) argument.
# Operators like sort and map are unaffected. However, certain
# constructs that used to be in the statement class may
On Wed, Feb 27, 2002 at 10:11:13AM -0800, Austin Hastings wrote:
Cwhen is a conditional like Cif, not a topicalizer.
Right, it's a topicalizee, the victim of topicalization. And so it uses
$_ or $x or $! or whatever the current topic is.
i.e. a defaulting construct or topic sensitive
From: Brent Dax [mailto:[EMAIL PROTECTED]]
Garrett Goebel:
# Larry Wall in Apocalypse 4 writes:
# this special rule only applies to constructs that take a
# block (that is, a closure) as their last (or only) argument.
# Operators like sort and map are unaffected. However, certain
#
From: Allison Randal
Garrett Goebel wrote:
Why does Cwhen's EXPR pay attention to the topicalizer
regardless of associated variable?
Why introduce the special case?
Why? Because it's oh-so dwim. Think about it, if you've just typed a
given $x { ...
or
given
Dang... why isn't you see so many more obvious errors, the moment after you
click send?
From: Garrett Goebel [mailto:[EMAIL PROTECTED]]
or without the special case:
$hi = 'hello';
$x = 'burt';
for $hi - $y {
given {
when /burt/ { print Go Away };
default { print $y };
On Wed, Feb 27, 2002 at 04:24:48PM -0600, Garrett Goebel wrote:
From: Allison Randal
Not just some value external to the switch, but the value in $_.
I now see the DWIM aspect. Thanks BTW.
But how often will people have non- Cwhen statements within a Cgiven
scope that'll need the
18 matches
Mail list logo