Re: getters and setters not an lvalue

2012-11-01 Thread Jacob Carlborg
On 2012-10-31 23:48, Adam D. Ruppe wrote: I tried it and found getting almost there is easy... but getting it to work in a bunch of edge cases is incredibly difficult. I can imagine operator overloading, opDispatch and similar features making it a lot harder. -- /Jacob Carlborg

Re: getters and setters not an lvalue

2012-10-31 Thread Andrej Mitrovic
On 10/31/12, Adam D. Ruppe wrote: > On Wednesday, 31 October 2012 at 22:46:17 UTC, Andrej Mitrovic > wrote: >> I wonder if this is low-hanging fruit to implement in the DMD >> frontend. > > I tried it and found getting almost there is easy... but getting > it > to work in a bunch of edge cases is

Re: getters and setters not an lvalue

2012-10-31 Thread Adam D. Ruppe
On Wednesday, 31 October 2012 at 22:46:17 UTC, Andrej Mitrovic wrote: I wonder if this is low-hanging fruit to implement in the DMD frontend. I tried it and found getting almost there is easy... but getting it to work in a bunch of edge cases is incredibly difficult.

Re: getters and setters not an lvalue

2012-10-31 Thread Andrej Mitrovic
On 10/31/12, Michael wrote: > http://d.puremagic.com/issues/show_bug.cgi?id=8006 I wonder if this is low-hanging fruit to implement in the DMD frontend. Could we really just implement "var.property += 5;" to "var.property = var.property + 5;" or is it much more complicated than that.. I might ha

Re: getters and setters not an lvalue

2012-10-31 Thread Michael
but this gives the following error: test.d(4): Error: test.value() is not an lvalue Is there a rationale behind this decision of not translating test.value+=1 to test.value= test.value +1 ? http://forum.dlang.org/thread/xcbweciovapinaicx...@forum.dlang.org and http://d.puremagic.com/issues/sh

Re: getters and setters not an lvalue

2012-10-31 Thread maarten van damme
Ok, makes sense now :) 2012/10/31 monarch_dodra : > On Wednesday, 31 October 2012 at 12:46:12 UTC, maarten van damme wrote: >> >> In my current code I'd like to do something ala: >> >> void main(){ >> getsettest test=new getsettest(); >> >> test.value+=1; >> } >> >>

Re: getters and setters not an lvalue

2012-10-31 Thread monarch_dodra
On Wednesday, 31 October 2012 at 12:46:12 UTC, maarten van damme wrote: In my current code I'd like to do something ala: void main(){ getsettest test=new getsettest(); test.value+=1; } class getsettest{ int myvalue; this(

Re: getters and setters not an lvalue

2012-10-31 Thread Maxim Fomin
On Wednesday, 31 October 2012 at 12:46:12 UTC, maarten van damme wrote: Is there a rationale behind this decision of not translating test.value+=1 to test.value= test.value +1 ? Probably there were no such decision at all and you just ran into issue which has never worked. BTW properties are s

Re: getters and setters not an lvalue

2012-10-31 Thread Maxim Fomin
On Wednesday, 31 October 2012 at 12:46:12 UTC, maarten van damme wrote: In my current code I'd like to do something ala: void main(){ getsettest test=new getsettest(); test.value+=1; } class getsettest{ int myvalue; this(

Re: getters and setters not an lvalue

2012-10-31 Thread Jacob Carlborg
On 2012-10-31 13:46, maarten van damme wrote: In my current code I'd like to do something ala: void main(){ getsettest test=new getsettest(); test.value+=1; } class getsettest{ int myvalue; this(){ }

Re: getters and setters not an lvalue

2012-10-31 Thread Regan Heath
On Wed, 31 Oct 2012 14:08:18 -, maarten van damme wrote: Ok, looking forward to the fix :) Btw, I have a foreach loop and in that foreach loop I want to decide if the current element can stay and if not, I want to remove it. If removing it yields an empty range in the foreach loop, it cr

Re: getters and setters not an lvalue

2012-10-31 Thread maarten van damme
Ok, looking forward to the fix :) Btw, I have a foreach loop and in that foreach loop I want to decide if the current element can stay and if not, I want to remove it. If removing it yields an empty range in the foreach loop, it crashes. What's the sane way to do this?

Re: getters and setters not an lvalue

2012-10-31 Thread bearophile
maarten van damme: Is there a rationale behind this decision of not translating test.value+=1 to test.value= test.value +1 ? I think it's a temporary limit, meant to be removed/fixed. Bye, bearophile

getters and setters not an lvalue

2012-10-31 Thread maarten van damme
In my current code I'd like to do something ala: void main(){ getsettest test=new getsettest(); test.value+=1; } class getsettest{ int myvalue; this(){ } @property{ int valu