Polysemous Values Qustion

davidl davidl at 126.com
Mon Sep 24 18:19:27 PDT 2007


在 Tue, 25 Sep 2007 08:40:40 +0800,Robert Frser  
<fraserofthenight at gmail.com> 写道:

> Can someone giv me an example where polysemous values could apply to a  
> class (given the class has (multiple) opImplicitCastTo/From)

I don't understand what you mean by that. Since the lvalue type , and  
rvalue type is known.
If I understand you correctly, there won't be such a problem for  
assignment expression. Only
happens if there're

void funcoverload(Can_Cast_From_ObjectB_1 A)
void funcoverload(Can_Cast_From_ObjectB_2 C)

funcoverload(ObjectB);  <-- this calling is ambiguous. Cause it can cast  
to either A or C.

and similar situation is
ObjectB gets the opImplicitTo ObjectC
ObjectA gets the opImplicitFrom ObjectB

so a calling of

void funcoverload(ObjectC c)
void funcoverload(ObjectA a)

funcoverload(ObjectB);   <-- this would run into the same problem as the  
previous example



-- 
使用 Opera 革命性的电子邮件客户程序: http://www.opera.com/mail/



More information about the Digitalmars-d mailing list