Property discussion wrap-up
Zach the Mystic
reachBUTMINUSTHISzach at gOOGLYmail.com
Wed Jan 30 09:07:58 PST 2013
On Wednesday, 30 January 2013 at 06:38:32 UTC, Rob T wrote:
> opCall requires parens, probably to disambiguate from alias
> this.
>
> string A
> {
> int i;
> int opCall() { return _i; }
> }
>
> A a,
>
> int i = a; // error
> int i = a(); // works
>
> You can however do this
>
> alias opCall this;
>
> int i = a; // works
> int i = a(); // works too
>
> --rt
I guess that's how to do it. So now we have all three. Mandate
parens with opCall. Allow both with alias opCall this, and
disallow parens with opGet.
So let's go back to my previous argument. Aside from a few
language changes, such as making current nested structs into
nested static structs, and introducing opGet, a @property is
nothing but a poor man's struct. Destroy.
More information about the Digitalmars-d
mailing list