[Issue 1596] op*Assign should return void

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jul 5 05:28:24 PDT 2011


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


Steven Schveighoffer <schveiguy at yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |schveiguy at yahoo.com


--- Comment #5 from Steven Schveighoffer <schveiguy at yahoo.com> 2011-07-05 05:23:14 PDT ---
D should not be forcing behavior on normal functions, which operators are. 
They are special in that if defined in a specific way, they will be used when
using operators, but other than that, they are ordinary functions.  If you want
to force behavior, make the operators keywords (like C++).  Otherwise, you have
special rules for ordinary symbols.  Lowering is supposed to work by simply
rewriting code, not by requiring certain signatures.

This relates to Andrei's later bug regarding opEquals - the compiler currently
requires a certain signature for opEquals, and it simply gets in the way of
writing efficient or usable code.

Besides, I think Andrei's original point is that it was impossible to do the
most efficient thing (return the lvalue of this), which is no longer the case.
So this was an attempt to solve that problem using a language rule instead of
adding ref returns.

I think this bug is very obsolete.

-- 
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