Possible @property compromise
Jacob Carlborg
doob at me.com
Wed Jan 30 07:14:10 PST 2013
On 2013-01-30 03:15, Rob T wrote:
> Even with @property restrictions, I still don't think it will work as
> expected. For example, if the variable is a struct, then you have to
> disallow operations on the struct from outside.
>
> Example:
>
> struct Y { int a; }
>
> struct X{ @property Y y; }
>
> X x;
>
> x.y.a = 4; // <- this has to be illegal!
>
> Reason?
>
> struct X{
>
> Y _y;
>
> @property Y y{ return _y; }
>
> }
>
> // this won't change _y as it did before.
> x.y.a = 4;
That would require some property rewrite by the compiler.
--
/Jacob Carlborg
More information about the Digitalmars-d
mailing list