Re: proposal: when-blocks, and binding $_

2002-02-27 Thread Austin Hastings
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

Topicalizers: Why does when's EXPR pay attention to topicalizer regardless of associated variable?

2002-02-27 Thread Garrett Goebel
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

Ambiguity with regards to switch statements special handling of Class::Name

2002-02-27 Thread Garrett Goebel
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 { ... } }

Re: More questions on downwards binding.

2002-02-27 Thread Austin Hastings
--- 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 : { ... } : :

Semicolons: where they're needed

2002-02-27 Thread 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 become expression

RE: Topicalizers: Why does when's EXPR pay attention to topicalizer r egardless of associated variable?

2002-02-27 Thread Garrett Goebel
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/

Re: Ambiguity with regards to switch statements special handling of C lass::Name

2002-02-27 Thread Austin Hastings
--- 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

Re: Nevermind -- Ambiguity with regards to switch statements special handling of C lass::Name

2002-02-27 Thread Austin Hastings
--- 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?

Re: proposal: when-blocks, and binding $_

2002-02-27 Thread Allison Randal
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

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

2002-02-27 Thread Austin Hastings
--- 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

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

2002-02-27 Thread Allison Randal
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

Re: proposal: when-blocks, and binding $_

2002-02-27 Thread Austin Hastings
--- 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

RE: Semicolons: where they're needed

2002-02-27 Thread Brent Dax
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

Re: proposal: when-blocks, and binding $_

2002-02-27 Thread Allison Randal
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

RE: Semicolons: where they're needed

2002-02-27 Thread Garrett Goebel
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 #

RE: Topicalizers: Why does when's EXPR pay attention to topicalizer r egardless of associated variable?

2002-02-27 Thread Garrett Goebel
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

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

2002-02-27 Thread Garrett Goebel
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 };

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

2002-02-27 Thread Allison Randal
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