static property without return type

Timon Gehr timon.gehr at gmx.ch
Sat Mar 16 17:57:24 PDT 2013


On 03/16/2013 11:47 PM, Andrej Mitrovic wrote:
> On Saturday, 16 March 2013 at 22:34:01 UTC, Michael wrote:
>> Why Dmd accepts?
>>
>> class E
>> {
>>     @property public static pro(Object v)
>>     {
>>
>>     }
>> }
>>
>> Dmd 2.062 Win 64
>
> It's a (mis)feature.

It is return type deduction.

> Whenever you have an attribute it acts as if 'auto'
> is used  if there is no return type.
>

No, if the return type is missing, it is deduced.
'auto' does not mean type deduction! It's a crutch for the parser. In 
fact, the meaning of 'auto' is basically carried over unchanged from C.

> Personally I've never found this a useful feature.

Requiring 'auto' would be inconsistent.


More information about the Digitalmars-d mailing list