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: AUTLOAD and $_
by Sam Vilain other posts by this author
Jun 26 2005 4:52PM messages near this date
Re: AUTLOAD and $_ | Re: AUTLOAD and $_
Piers Cawley wrote:
>  For myself, I'd like to see AUTOLOAD with a signature along the lines of:
>     sub AUTOLOAD (Symbol $sym, ArgumentCollection $args, Continuation $cc)
>       returns (Code | Pair)
>     {
>       ...
>     }
>  This presupposes a deal of support infrastructure, but also provides
>  flexibility. For the 'NullObject' case, you'd simply do C<$cc()> to return
>  directly to the caller, skipping over whatever Perl is up to.

That's an excellent suggestion.  After your very enlightening discussion
about continuations in IRC, this popped to mind as an interesting application
for them, along with exception handlers.

This would be great for at least AUTOSUB and AUTOMETH.

However, for AUTOLOAD we're looking for simple Perl 5 alikeness.  And in
Perl 5, the sub name was passed out of band.

So, we need a compromise somewhere, please @cabal.pick:

   - just go for old AUTOLOAD + $AUTOLOAD interface and spit warnings
     profusely
     -OR-
   {
   - allow topic to refer to variables in lexical scope, but not in @_
     (and pick a good name for $?SUB.called_as)
     -OR-
   - allow generic out-of-band parameters to be passed in
   }
   implies {
       - there needs to be a special subroutine calling method, similar to
         .assuming that lets you do this
         -OR-
       - the method prototype, and specify some way that methods
         defined without a signature can inherit it from somewhere else.
   }
     -OR-
   - declare the topic to be the only out-of-band parameter that does this.
     To avoid it being an accidental global, it would need to be declared with
     "my $_" when used in this manner (of course, other methods like for, given,
     etc that set it have the declaration implicit).
     -OR-
   - scrap complete AUTOLOAD interface compatibility
     -OR-
   - insert solution here ;)

Sam.
Thread:
Sam Vilain
Juerd
Sam Vilain
Maxim Sloyko
Juerd
Adam Kennedy
Juerd
Luke Palmer
Chromatic
Juerd
Chromatic
Juerd
Luke Palmer
John Macdonald
Chromatic
Juerd
Rod Adams
Larry Wall
Rod Adams
Chromatic
Juerd
Sam Vilain
Sam Vilain
Juerd

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