ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> perl6-language
perl6-language
Re: caller and want
by Gaal Yahas other posts by this author
Jun 12 2005 6:19AM messages near this date
Re: caller and want | Musing on registerable event handlers for some specific events
On Wed, Jun 08, 2005 at 12:20:57PM -0700, Larry Wall wrote:
>  : I'm not sure how this selection mechanism is meant to be used.
>  
>  The skip is meant to be applied after filtration.  Don't filter out
>  things you want to see later, in other words.

Okay, caller done as r4555. Without :label for now, because we don't
have that yet.

>  : - AES does not enumerate the complete member set. We can use that now :)
>  
>  Um.  That's something I wouldn't mind delegating to whoever is slogging
>  it out on the ground.

That's fine for caller, but half the examples for want imply things that
aren't available in Pugs' exisitng want yet (count, rw), and I think they
might not be straightforward to add. If there are other things come to
mind they'll probably be easier to add all at once.

[.sub ->  .subname ; .sub returns coderef]
>  That's the direction we're going with &?SUB and $?SUBNAME, so I don't
>  see why it couldn't apply here too.
 
Done.

>  It would be nice if the interfaces were similar where they try to do
>  similar things.
>  
>  But then, it might be nice to copy over the :nth($n) interface from
>  pattern matching too, somehow or other.  Right now our selectors don't
>  have a way to generalize that.  You almost want to be able to say
>  something like caller(3rd(Sub)), which causes ~~ to match Sub, but
>  only on the third thing that could be construed as a Sub, presuming
>  ~~ is treating the other argument as some kind of iterator.  But up
>  till now we've been treating such iterators as external to ~~, with
>  the args matched one at a time.  One could imagine seeing things like:
>  
>      given =$IN {
>  	when 1st(/foo/)  {...}
>  	when 2nd(/bar/)  {...}
>  	when 3rd(/baz/)  {...}
>      }
>  
>  but the semantics of such a construct are more than somewhat problematic.

Is caller so time-critical that saying 3rd(caller(Sub)) is too bad?

FWIW, this is how I interpreted caller(Sub, :skip<2> ), as "the third
sub". And unless I'm wrong, caller(Block, :skip<2> , :label<moose>) would
mean, "once you get to the third Block, look on for one labeled "moose".
So we don't have a way to skip three methods and then look for a labeled
block, but if the user really wants that, let them grovel over a
complete call chain themselves.

-- 
Gaal Yahas <gaal@[...].org> 
http://gaal.livejournal.com/
Thread:
Larry Wall
Gaal Yahas

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved