static property without return type

deadalnix deadalnix at gmail.com
Sat Mar 16 22:26:16 PDT 2013


On Sunday, 17 March 2013 at 02:41:18 UTC, Jonathan M Davis wrote:
> On Sunday, March 17, 2013 02:06:08 Andrej Mitrovic wrote:
>> On 3/17/13, Timon Gehr <timon.gehr at gmx.ch> wrote:
>> > No, if the return type is missing, it is deduced.
>> 
>> What are you talking about? You can't write:
>> 
>> foo() { return 0; }
>> 
>> > '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.
>> 
>> auto means something completely different in C.
>
> Yeah. All auto means in C is that the variable has local 
> lifetime. At this
> point, in C, it's completely pointless, because that's the 
> default (you'd have
> to use something like static or register to make it otherwise).
>
> D's auto is the basically the same as C++11's auto, which means 
> that the type
> is inferred, which is something completely different.
>

Timon is right. D need at least one storage class to trigger type 
inference. auto is basically a storage class that does nothing in 
D.


More information about the Digitalmars-d mailing list