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: reduce metaoperator on an empty list
by "TSa (Thomas Sandlaß)" other posts by this author
Jun 17 2005 12:15AM messages near this date
Re: reduce metaoperator on an empty list | Re: reduce metaoperator on an empty list
Damian Conway wrote:
> > Let's assume that op is overloaded for two completely unrelated types
> > A and B, which are both defining their respective identity elements
> > but !(A.identval =:= B.identval). How should the &op multi method object
> > pick the correct one *without* looking at $value's type?
>  
>  
>  Your mistake is in thinking that the identity trait is on the operand 
>  type. It isn't; it's on the operator itself.

I agree, that the pair of operator and type which determines the identity
element can be stored as a trait of the operator implementation. *But* the
operator selection from the multi has to use the type of $value. In
particular it might not be inferable at compile time. Thus the compiler
has to produce MMD code and hook half way into it to perform the selected
call with two args: the identity &op.identval and $value.

Which brings me to the question: is there a syntax to invoke the
target selection from a multi? E.g. &op.select($value,$value) here?
Or is it &op:($value,$value)?
-- 
TSa (Thomas SandlaÃ?)
Thread:
=22TSa_=28Thomas_Sandla=DF=29=22
Larry Wall
=22TSa_=28Thomas_Sandla=DF=29=22
Damian Conway
"TSa (Thomas Sandlaß)"

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