digitalmars.D.bugs - [Issue 808] New: using properties as lvalues
- d-bugmail puremagic.com (22/22) Jan 06 2007 http://d.puremagic.com/issues/show_bug.cgi?id=808
- d-bugmail puremagic.com (15/15) Apr 02 2009 http://d.puremagic.com/issues/show_bug.cgi?id=808
- d-bugmail puremagic.com (8/8) May 07 2009 http://d.puremagic.com/issues/show_bug.cgi?id=808
- d-bugmail puremagic.com (16/16) May 31 2012 http://d.puremagic.com/issues/show_bug.cgi?id=808
- d-bugmail puremagic.com (12/12) May 31 2012 http://d.puremagic.com/issues/show_bug.cgi?id=808
- d-bugmail puremagic.com (17/17) May 31 2012 http://d.puremagic.com/issues/show_bug.cgi?id=808
- d-bugmail puremagic.com (7/7) May 31 2012 http://d.puremagic.com/issues/show_bug.cgi?id=808
- d-bugmail puremagic.com (13/13) May 31 2012 http://d.puremagic.com/issues/show_bug.cgi?id=808
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 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 *** Bug 2949 has been marked as a duplicate of this bug. *** --
May 07 2009
http://d.puremagic.com/issues/show_bug.cgi?id=808 Leandro Lucarella <leandro.lucarella sociomantic.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |leandro.lucarella sociomant | |ic.com Version|0.178 |D2 2012-05-31 04:36:03 PDT --- This is a highly voted enhancement request but there is no "official" statement about it. Would be nice to have some "official" comment for votes with so many votes. Is this intended to be implemented at all? Otherwise I guess is better to close it with WONTFIX to decrese bugzilla's "noise". -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 31 2012
http://d.puremagic.com/issues/show_bug.cgi?id=808 Dmitry Olshansky <dmitry.olsh gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dmitry.olsh gmail.com 04:45:19 PDT --- I'll fork the language if it's not fixed. And of course I'll seduce the whole Russian communitiy to follow suit ;) Seriously, it's important. I've hit it like 10+ time just today. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 31 2012
http://d.puremagic.com/issues/show_bug.cgi?id=808 Vladimir Panteleev <thecybershadow gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED 04:46:16 PDT --- The examples in my original post, as well as Witold's "array.length *= 2", work now. This issue originally referred to built-in language properties, like .length. The property kind of properties can be lvalues if the getter returns an lvalue - for example, property ref int x() { return _x; }, or as Witold mentioned, using wrapper types. I think we can consider this bug as resolved today. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 31 2012
http://d.puremagic.com/issues/show_bug.cgi?id=808 04:47:51 PDT --- Thx Vladimir, I haven't tried ref return. So silly. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 31 2012
http://d.puremagic.com/issues/show_bug.cgi?id=808 Jonathan M Davis <jmdavisProg gmx.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jmdavisProg gmx.com PDT --- And using ref with a property pretty much defeats its entire purpose, since setting it ends up completely bypassing the getter. We really need to be able to have stuff like prop++ work _without_ ref. But there's another enhancement -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 31 2012