digitalmars.D.bugs - [Issue 808] New: using properties as lvalues
- d-bugmail puremagic.com Jan 06 2007
- d-bugmail puremagic.com Apr 02 2009
- d-bugmail puremagic.com May 07 2009
http://d.puremagic.com/issues/show_bug.cgi?id=808 Summary: using properties as lvalues Product: D Version: 0.178 Platform: PC OS/Version: Windows Status: NEW Severity: enhancement Priority: P3 Component: www.digitalmars.com AssignedTo: bugzilla digitalmars.com ReportedBy: thecybershadow gmail.com I've been wondering - what is actually preventing us to operate with properties like real lvalues? For example, int[] array; array.length++; // Error: (array).length is not an lvalue array.length += 2; // Error: (array).length is not an lvalue however, array.length = array.length + 1; // works Unless there's a fair reason of why this isn't viable, I'd suggest implementing this. --
Jan 06 2007
http://d.puremagic.com/issues/show_bug.cgi?id=808 ------- Comment #1 from baryluk smp.if.uj.edu.pl 2009-04-02 08:49 ------- Assigment to properties is actually call to some method which actually do other operations (like reallocation). I think that p op= x, properties operations should be defined as p = p op x Also for user defined properties (if both setter and getter is availble, so "lvalue-like" behaviour can be emulated in this way). Cases in which p += x, should be performed differently can always be emulated by using wrapper struct/class, which caries state and overloads opAddAssign. This cases are rear, but still possible. (usefull for some highly optimized codes, or synchronized/atomic changes, or loging actuall changes) array.length *= 2; is one of the most annoying :) --
Apr 02 2009
http://d.puremagic.com/issues/show_bug.cgi?id=808 dsimcha yahoo.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ghaecker idworld.net ------- Comment #2 from dsimcha yahoo.com 2009-05-07 08:06 ------- *** Bug 2949 has been marked as a duplicate of this bug. *** --
May 07 2009









d-bugmail puremagic.com 