www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4903] New: opopAssignRight is needed for operator overloading

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4903

           Summary: opopAssignRight is needed for operator overloading
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: clugdbug yahoo.com.au


--- Comment #0 from Don <clugdbug yahoo.com.au> 2010-09-20 19:02:14 PDT ---
Cases where it is required are limited, but one example is BigInt.

int x = 14;
BigInt y = 3;

x =  x / y; // OK.
x /= y;     // No way to support this

Applies to /= and %=.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 20 2010
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4903


Witold Baryluk <baryluk smp.if.uj.edu.pl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |baryluk smp.if.uj.edu.pl


--- Comment #1 from Witold Baryluk <baryluk smp.if.uj.edu.pl> 2010-10-31
05:57:50 PDT ---
I would also like this feature.

One of the reason this is not supported, is that in fact

int x = 14;
BigInt y = 3;
x = x/y;

is, actually x = cast(int)(x/y);

And there is no way to change type in opAssign (old opXXXAssign).

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