--- Garrett Goebel <[EMAIL PROTECTED]> wrote:
> Allison Randal wrote:
> > Garrett Goebel wrote:
> > >
> > > I guess the next question in the context of the following is:
> > > 
> > > Larry Wall wrote in Apocalypse 4:
> > > >
> > > > It should be possible to make user-extensible syntax look
> > > > just like built-in syntax. 
> > > 
> > > How would I create a user-extensible construct that works 
> > > like given/when? I'm guessing the answer is: you don't.
> > 
> > I sure hope you can. I intend to use it.
> 
> Hmm... Out of curiosity what kind of user-extensible topicalizer
> aware
> constructs would you make? And thinking of this in the context of
> user
> defined functions, am I correct in assuming that we would need to be
> able to
> specify per-parameter topicalizer awareness? So this would impact
> whatever
> replaces function prototypes?

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... )

> If topicalizers aren't going to be limited to given/when, but may
> slowly
> creep in wholesale, then I have a few more questions...
> 
> 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').

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?

> Which is fine when there's only one topicalizer. But is the C<when>
> EXPR's
> current topicalizer awareness limited to the current C<given> scope?
> Or the
> scope of any topicalizer which might be later introduced? I.e., will
> we be
> able to specify which topicalizers a topicalizee pays attention to?
> Or will
> all topicalizees be aware of all topicalizers?

I'll claim that it's reasonable to make C<when> topic-narrow, and only
see the current topic.


=Austin


__________________________________________________
Do You Yahoo!?
Yahoo! Greetings - Send FREE e-cards for every occasion!
http://greetings.yahoo.com

Reply via email to