www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3735] New: op=

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

           Summary: op=
           Product: D
           Version: 2.038
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: www.digitalmars.com
        AssignedTo: nobody puremagic.com
        ReportedBy: ellery-newcomer utulsa.edu



08:46:43 PST ---
Spec says a op= b is semantically equivalent to a = a op b.

Spec lies, or at least is at odds with DMD.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 23 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3735


Stewart Gordon <smjg iname.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
                URL|                            |http://www.digitalmars.com/
                   |                            |d/1.0/expression.html
                 CC|                            |smjg iname.com
           Platform|Other                       |All
            Version|2.038                       |D1 & D2
         OS/Version|Linux                       |All



I assume you're talking about the fact that code like this fails:
----------
class Qwert {
    Qwert opAdd(Qwert yuiop) { return this; }
}

void main() {
    Qwert asfdg = new Qwert;
    asdfg += asdfg;
}
----------
I entirely agree that this code should work, on the bases both of common sense
and of this spec.

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




Apart from Stewart's comment, there's also the case of >>>.

a >>>= b is different to a = a >>> b, if a is short or byte.

(The first does an unsigned shift, the second does a signed shift).

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 18 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3735


timon.gehr gmx.ch changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |timon.gehr gmx.ch



The same halds for other binary operators. The sentence should probably just be
removed from the spec.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 18 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3735





 Apart from Stewart's comment, there's also the case of >>>.
 
 a >>>= b is different to a = a >>> b, if a is short or byte.
 
 (The first does an unsigned shift, the second does a signed shift).
Oh yes, that crazy abomination that is promotion. Suppose you have byte a = cast(byte) 0b11110000; // why does it insist on a cast? a = a >>> 3; then what actually happens is 0b11110000 >> 3 promote to int 0b1111111111110000 >> 3 apply shift 0b0001111111111110 convert back to a byte 0b11111110 If you shift by 25 or more (17 or more for short), you'll start to see the zero bits come through. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 18 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3735





 byte a = cast(byte) 0b11110000;  // why does it insist on a cast?
Because 240 does not fit inside the range -128 to 127. static assert(0b11110000 != cast(byte)0b11110000); -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 18 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3735




Commit pushed to
https://github.com/D-Programming-Language/d-programming-language.org

https://github.com/D-Programming-Language/d-programming-language.org/commit/2b757bdcc82c69ff4021361acd93f8a0b26df65c
fix Issue 3735 - op=

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 23 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3735


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |FIXED


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