DIP23 draft: Fixing properties redux
Steven Schveighoffer
schveiguy at yahoo.com
Sun Feb 3 08:13:16 PST 2013
On Sun, 03 Feb 2013 10:35:29 -0500, TommiT <tommitissari at hotmail.com>
wrote:
> On Sunday, 3 February 2013 at 08:16:08 UTC, Andrei Alexandrescu wrote:
>> Walter and I have had a discussion on how to finalize properties.
>>
>> http://wiki.dlang.org/DIP23
>> [..]
>
> What happens here?
>
> struct S
> {
> int _n;
>
> @property ref int prop()
> {
> return _n;
> }
> }
>
> @property void prop(ref S s, int n)
> {
> s._n = 42;
> }
>
> void main()
> {
> S s;
> s.prop = 10;
> }
I would expect it to call S.prop, not the global prop. If not, that
should be a bug (Kenji, you should add this case to the tests if not
already there)
With UFCS, you cannot override type-specified methods and properties.
-Steve
More information about the Digitalmars-d
mailing list