Re: property/opAddAssign problem

2009-12-30 Thread Steven Schveighoffer
On Tue, 29 Dec 2009 13:44:18 -0500, teo wrote: On Tue, 29 Dec 2009 09:12:15 -0500, Steven Schveighoffer wrote: Eventually, marking Prop as a @property should also work (haven't tested it, it may work now): @property A Prop() { return a; } ... b.Prop += 3; // compiles -Steve Unfortunat

Re: property/opAddAssign problem

2009-12-30 Thread teo
On Tue, 29 Dec 2009 09:12:15 -0500, Steven Schveighoffer wrote: > On Tue, 29 Dec 2009 09:10:14 -0500, Steven Schveighoffer > wrote: > >> On Tue, 29 Dec 2009 09:01:38 -0500, teo >> wrote: >> >>> Consider following: >>> >>> class A >>> { >>> int m; >>> void opAddAssign(int n) { m += n; } >>>

Re: property/opAddAssign problem

2009-12-30 Thread Steven Schveighoffer
On Tue, 29 Dec 2009 09:10:14 -0500, Steven Schveighoffer wrote: On Tue, 29 Dec 2009 09:01:38 -0500, teo wrote: Consider following: class A { int m; void opAddAssign(int n) { m += n; } } class B { A a; this() { a = new A; } A Prop() { return a; } } void main() { B b = new B

Re: property/opAddAssign problem

2009-12-30 Thread Steven Schveighoffer
On Tue, 29 Dec 2009 09:01:38 -0500, teo wrote: Consider following: class A { int m; void opAddAssign(int n) { m += n; } } class B { A a; this() { a = new A; } A Prop() { return a; } } void main() { B b = new B; b.Prop += 3; } I get a compilation error (dmd v2.037): test.d(1

property/opAddAssign problem

2009-12-30 Thread teo
Consider following: class A { int m; void opAddAssign(int n) { m += n; } } class B { A a; this() { a = new A; } A Prop() { return a; } } void main() { B b = new B; b.Prop += 3; } I get a compilation error (dmd v2.037): test.d(17): Error: 'b.Prop' is not a scalar, it is a A() test