property / getProperty() / setProperty()

Jarrett Billingsley jarrett.billingsley at gmail.com
Sat Aug 1 11:42:55 PDT 2009


On Sat, Aug 1, 2009 at 2:38 PM, Ary Borenszweig<ary at esperanto.org.ar> wrote:
> Rainer Deyke escribió:
>>
>> Ary Borenszweig wrote:
>>>
>>> The "property" just signals that the function is a property. But it's
>>> still a function and all of the previous rules that existed are still
>>> valid.
>>
>> My problem with the 'property' syntax:
>>
>> Possibility 1: the property still acts like a function, so you can still
>> do 'x.a()' when you mean 'x.a'.
>>
>> Possibility 2: the property does not act like a function, so you can no
>> longer get a delegate to the property getter.
>>
>> Possibility 3: the property sometimes acts like a function and sometimes
>> not, and you haven't defined the distinction.
>
> None of those are correct. See Jarrett's post.
>
> property {
>  int x() { }
>  int x(int a) { }
> }
>
> auto a = x; // OK
> auto a = x(); // Wrong
> x = 2; // OK
> x(2); // Wrong

And furthermore, I mentioned that &obj.foo would always get the
address of the member 'foo' from 'obj', even if 'foo' was a property.

But hey, it's not like it matters anyway.  We're pissing in the ocean.



More information about the Digitalmars-d mailing list