Re: property returning a reference vs returning a value

2012-06-20 Thread Jonathan M Davis
On Wednesday, June 20, 2012 09:03:44 cal wrote: > On Wednesday, 20 June 2012 at 06:34:06 UTC, Jonathan M Davis > > wrote: > > You can't overload on return type. The parameters need to be > > different, or the functions are going to conflict. > > Ah, that explains it, thanks. I find ref properties

Re: property returning a reference vs returning a value

2012-06-20 Thread cal
On Wednesday, 20 June 2012 at 06:34:06 UTC, Jonathan M Davis wrote: You can't overload on return type. The parameters need to be different, or the functions are going to conflict. Ah, that explains it, thanks. I find ref properties useful for making a member variable behave like it is public,

Re: property returning a reference vs returning a value

2012-06-19 Thread Jonathan M Davis
On Wednesday, June 20, 2012 05:42:25 cal wrote: > This doesn't compile, because the assignment matches both > property functions in S: > > struct S > { > @property int a() { return _a; } > @property ref int a() { return _a; } > int _a; > } > > int main() > { > S s; > s.a

property returning a reference vs returning a value

2012-06-19 Thread cal
This doesn't compile, because the assignment matches both property functions in S: struct S { @property int a() { return _a; } @property ref int a() { return _a; } int _a; } int main() { S s; s.a = 5; } But I would like to be able to do different things when I pass out a r