Thread overview | ||||||
---|---|---|---|---|---|---|
|
September 06, 2005 Put(...) | ||||
---|---|---|---|---|
| ||||
= calls Put() but += doesn't (or I miss something?). I tried all verisions of Put()... Is there any other way to get notified when variable is modified by += operator. What I mean: var a=new mystuff; a=5; // I get notified, Put() is called a+=5; // nothing happens |
September 09, 2005 Re: Put(...) | ||||
---|---|---|---|---|
| ||||
Posted in reply to bobef | "bobef" <bobef@lessequal.com> wrote in message news:dfl1nn$1pfq$1@digitaldaemon.com... > = calls Put() but += doesn't (or I miss something?). I tried all > verisions of Put()... Is there any other way to get notified when > variable is modified by += operator. > What I mean: > > var a=new mystuff; > a=5; // I get notified, Put() is called > a+=5; // nothing happens Check out the code in opcodes.d under IRaddass:, that's what gets executed for a +=. Either putVnumber() or putVstring() is called. |
September 09, 2005 Re: Put(...) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | Walter Bright wrote:
> "bobef" <bobef@lessequal.com> wrote in message
> news:dfl1nn$1pfq$1@digitaldaemon.com...
>
>>= calls Put() but += doesn't (or I miss something?). I tried all
>>verisions of Put()... Is there any other way to get notified when
>>variable is modified by += operator.
>>What I mean:
>>
>>var a=new mystuff;
>>a=5; // I get notified, Put() is called
>>a+=5; // nothing happens
>
>
> Check out the code in opcodes.d under IRaddass:, that's what gets executed
> for a +=. Either putVnumber() or putVstring() is called.
>
>
Thank you, I'll check it out.
|
February 19, 2006 Re: Put(...) | ||||
---|---|---|---|---|
| ||||
Posted in reply to bobef | Adding this:
Dobject o_o=b.toObject();
if(o_o) o_o.Put(s,v,0);
after line 694 of opcodes.d seems to do the trick. I don't know if it is right to have zero for attributes and if it breaks something else but maybe time will tell (or Walter?). It is very nice because it could eliminate the need of setters/getters for certain functionality (like mywindow.setX() for example), which means less coding and less limitations, which is, I believe, cool. I don't know if it isn't against ECMA, but maybe it worths adding to the official distribution?
bobef wrote:
> Walter Bright wrote:
>> "bobef" <bobef@lessequal.com> wrote in message
>> news:dfl1nn$1pfq$1@digitaldaemon.com...
>>
>>> = calls Put() but += doesn't (or I miss something?). I tried all
>>> verisions of Put()... Is there any other way to get notified when
>>> variable is modified by += operator.
>>> What I mean:
>>>
>>> var a=new mystuff;
>>> a=5; // I get notified, Put() is called
>>> a+=5; // nothing happens
>>
>>
>> Check out the code in opcodes.d under IRaddass:, that's what gets executed
>> for a +=. Either putVnumber() or putVstring() is called.
>>
>>
> Thank you, I'll check it out.
|
Copyright © 1999-2021 by the D Language Foundation