dynamic classes and duck typing

Walter Bright newshound1 at digitalmars.com
Mon Nov 30 19:12:02 PST 2009


Bill Baxter wrote:
> So we can overload on @property-ness?

No.

> I.e. this works
> 
> struct S
> {
> @property
> float x() { return 1.0f; }
> float x() { return 2.0f; }
> }
> 
> void main()
> {
>     S  s;
>     writefln("%s", s.x); // writes 1.0
>     writefln("%s", s.x()); // writes 2.0
> }

That just looks wrong.



More information about the Digitalmars-d mailing list