Re: More questions on downwards binding.

2002-02-26 Thread Larry Wall
[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 : { ... } : : Interpretation #2: : for @foo -> $a { $b := $a; ... } : :

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

2002-02-26 Thread Allison Randal
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 change between implicit and explicit operations? Well, I like the idea of having C and the C o

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

2002-02-26 Thread Brent Dax
Austin Hastings: # --- Allison Randal <[EMAIL PROTECTED]> wrote: # > On Tue, Feb 26, 2002 at 01:26:41PM -0800, Austin Hastings wrote: # > > # > > Possibility B- when-blocks accept a -> operator, which if used # > "naked" # > > binds the current localizer to $_. # > # > I think if I had a choice be

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

2002-02-26 Thread Austin Hastings
Which, then, would you like: To implicitly localize $_, losing access to an outer version, or to have to change between implicit and explicit operations? for @A { for @B -> $x { when /a/ { s/x/y/; } } } What should that do? =Austin --- Allison Randal <[EMAIL PROTECTED]> wrote: > On Tu

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

2002-02-26 Thread Allison Randal
On Tue, Feb 26, 2002 at 01:26:41PM -0800, Austin Hastings wrote: > > Possibility B- when-blocks accept a -> operator, which if used "naked" > binds the current localizer to $_. I think if I had a choice between given $y -> $x { when /a/ -> {...} when /b/ -> {...} ... }

proposal: when-blocks, and binding $_

2002-02-26 Thread Austin Hastings
The when keyword can use a localizer that makes its target obvious but slightly counter-intuitive. given $x { when /a/ { ... } } The problem is operations within the when-block that might expect to use $_, the defaultdefault variable. given $x { when /a/ { s/a/A/; } } After all, I used a def

Re: More questions on downwards binding.

2002-02-26 Thread Austin Hastings
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 { ... } Interpretation #2: for @foo -> $a { $b := $a; ... } I like this second one, as a short-cut, but it's not wo