@property

Michael pr at m1xa.com
Mon Aug 6 10:41:19 PDT 2012


On Saturday, 4 August 2012 at 20:53:53 UTC, Adam D. Ruppe wrote:
> On Saturday, 4 August 2012 at 19:08:58 UTC, Jacob Carlborg 
> wrote:
>> foo += 10;
>>
>> Is rewritten as:
>>
>> auto __tmp = foo;
>> foo = __tmp + 10;
>
>
> I did this and now I think this thing is almost done
>
> ===
> int a;
> @property int funcprop() {
>         writeln("calling the getter and getting ", a);
> 	return a;
> }
> @property int funcprop(int s) {
> 	writeln("calling the setter with ", s);
> 	return a = s;
> }
> void main() {
> 	funcprop = 40;
> 	funcprop += 10;
> }
> ===
>
> run:
>
> calling the setter with 40
> calling the getter and getting 40
> calling the setter with 50
>
>
>
>
> Looks right to me. Now I just have to check for the @property 
> tag on some of these rewrites and then clean it up and test for 
> a pull request.

It would be cool

http://forum.dlang.org/thread/xcbweciovapinaicxgbn@forum.dlang.org
and
http://d.puremagic.com/issues/show_bug.cgi?id=8006


More information about the Digitalmars-d mailing list