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-internals
perl6-internals
Re: P5 is the new P2
by Sam Ruby other posts by this author
Dec 21 2004 2:23AM messages near this date
[PATCH] Stomp a warning in pybuiltin.pmc | Hyphenated rule names [Was: Perl 6 Summary for 2004-12-06 through 2004-12-20]
Matt Fowles wrote:
>  
>     P5 is the new P2
>      Sam and Leo came to the conclusion that the current object should be
>      passed in P5 as well as P2. Currently they are waiting for Dan... Nudge,
>      Nudge...
>  
>      <http://xrl.us/ef8r>

I've implemented this, but I am near the point of recanting.  Examples 
of problematic code (both from t/pie/b3.t):

   return TT.__new__(cls, value)
   return T.__cmp__(a, b)

Where the latter ends up invoking the cmp method with three arguments 
instead of the customary two, and confusion reigns.

The way this is resolved in Python is with a distinction between "bound" 
and "unbound" methods.  Roughly, in Parrot terms, this is a distinction 
between methods where the object can be found in P2 and P5 respectively.

I'm resisting implementing this for now, but will likely have to cave 
ultimately.  To implement this would require a call to pmc_new on each 
method call on an instance, as well as reinserting the argument as the 
first parameter (shifting each of the curent parameters in the process). 
  Blech.

- Sam Ruby

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