[Issue 808] using properties as lvalues

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Apr 2 06:49:36 PDT 2009


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





------- Comment #1 from baryluk at 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 :)


-- 



More information about the Digitalmars-d-bugs mailing list