On Thu, Feb 28, 2002 at 03:28:29PM -0800, Austin Hastings wrote: > > --- Garrett Goebel <[EMAIL PROTECTED]> wrote: > > > > Hmm... Out of curiosity what kind of user-extensible topicalizer > > aware constructs would you make? > > Remember Larry's comment that the -> operator is a kind of "parameter > binding", and not something that's exclusive to given/when. > > The example: my $closure = -> $a { ... }; > > The point made was that sub($a) { ... } > would be different because it paid more attention to (I think) the > stack frame-y bits. > > I'm (optimistically) inferring that means that we'll be able to bind a > non-sub closure in the current context. > > maybe something like: > > my $closure = -> $a { ... }; > > sub doit(&) > { > my $cl = shift; > my @ary = ...; > > for @ary -> $cl; > } > > (Larry denied this once, but I suspect it's too close to doable for > Damian to let it slip by... ) It seems anti-dwim. Once people get used to the idea that "for @x -> $y" means that $y holds the values of @x, I think it would just be annoying to totally shift that meaning by having a $y in what looks like the same position do something entirely different. It's overusing the operator.
> > Larry Wall in Apocalypse 4 writes: > > > A when is the only defaulting construct that pays attention > > > to the current topicalizer regardless of which variable it > > > is associated with. > > Frankly, I'm not sure that -> and "topicalizer" are the same. I get the > feeling that -> is really "binding operator" and "topicalizer" is > 'given' (with the caveat, of course, that 'for' has an implicit > 'given'). Yes, C<given> and C<for> are topicalizers, -> is not. > I say this because some of the other examples of using -> don't have > any topicality to them, or they can be read to imply SO MUCH topicality > that the notion becomes worthless (think $_ in perl3/4). > > If we have: my $closure = -> $a { ... }; > > are we really to take $a as not only an arg to $closure but the default > topic within $a? Do you mean "the default topic within the closure"? Yes, but (if this worked) it wouldn't be -> that did it. > Larry Wall in Apocalypse 4 writes: > > Bare closures topicalize their first argument... It's a behavior of a closure, with or without the addition of aliasing. Allison