opCast using in template struct

Era Scarecrow rtcvb32 at yahoo.com
Thu Oct 18 16:05:47 PDT 2012


On Thursday, 18 October 2012 at 22:07:55 UTC, Timon Gehr wrote:
> On 10/18/2012 11:45 PM, bearophile wrote:
>> There are other cases. Generally the D compiler should add 
>> some warnings that help against operator overloading mistakes.
>
> I don't think that operator overloading gives rise to distinct 
> mistakes. For example, better error messages that just specify 
> the expected name, as in other cases of undefined identifiers, 
> would already fix this.

  Inside a function a badly named identifier becomes obvious since 
it outright tells you. But with regards to opOpAssign and other 
operator overloading I see the error message and I see the call 
but I don't see why it fails. Then I'll try adjusting the 
signature on my function, not realizing it never sees it in the 
first place due to misspelling.

  Maybe.. A general warning when something starts with 
'op(Op)?[A-Z]' but doesn't actually qualify as any of the 
override-able operators? That seems sensible...


More information about the Digitalmars-d-learn mailing list