Properties

Denis Koroskin 2korden at gmail.com
Sun Jan 11 22:32:02 PST 2009


On Mon, 12 Jan 2009 04:27:09 +0300, Sergey Kovrov <kovrov at gmail.com> wrote:

> On 1/11/2009 9:32 PM, Denis Koroskin wrote:
>> I'd also note that using foo without either "&" or "()" is still
>> necessary to get access to foo's set of properties:
>>
>> auto s = foo.stringof;
>> auto m = foo.mangleof;
>> // etc
>
> As far as I understand calling built-in properties eg.  
> ``foo.stringof()`` is not allowed. And it is not an lvalue. So no  
> referencing of a built-in properties possible either.
>

'&' and '()' were to be applied to foo rather that foo.property in the original message (i.e. &foo and foo()). I just provided example where neither '&' nor '()' were needed when accessing foo.

> I find this behavior most suitable for properties. The only exception is  
> built-in ``.reverse`` and ``.sort`` properties which seems counter  
> intuitive to me to be used without (). I think this should be something  
> callable (built-in functions, inherited methods, etc.) rather than  
> properties.
>
> -- serg.

Absolutely agree here.




More information about the Digitalmars-d mailing list