[Issue 3969] Built-in compile time errors against usage of wrong operator strings

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Dec 20 15:37:15 PST 2012


http://d.puremagic.com/issues/show_bug.cgi?id=3969


Andrej Mitrovic <andrej.mitrovich at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich at gmail.com


--- Comment #1 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2012-12-20 15:37:13 PST ---
We can collect all legal operators for opUnary, opBinary, etc, and statically
reject those which aren't legal. However I think this can only work for simple
cases, e.g.:

bool opBinary(string op : "==", T)(T t)

bool opBinary(string op, T)(T t) if (op == "==")

bool opBinary(string op, T)(T t) if (isOpEquals!op)

The 1st case is easy and doable.

The 2nd case might be doable, but it depends on how complex the expression is.

The 3rd case is off-hands, because there's no telling what isOpEquals does
internally - or rather it could be hugely expensive to do anaylsis on the
template instance.

So is it worth having? I'm very fond of the idea personally, at least for case
#1.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list