static property without return type

Peter Alexander peter.alexander.au at gmail.com
Mon Mar 18 01:46:23 PDT 2013


On Sunday, 17 March 2013 at 22:11:27 UTC, Andrej Mitrovic wrote:
> On 3/17/13, Artur Skawina <art.08.09 at gmail.com> wrote:
>> That's because "auto ref" is a hack.
>> IOW "auto ref" != "auto" + "ref", just as "static if" != 
>> "static" + "if".
>
> Both auto and auto ref are documented features,  type inference 
> with
> any storage class is not a documented feature.

Yes it is.

 From the spec (http://dlang.org/declaration.html)

-- Implicit Type Inference --
If a declaration starts with a StorageClass and has a 
NonVoidInitializer from which the type can be inferred, the type 
on the declaration can be omitted.

The first example is even:
static x = 3;

Any storage class will do. No need for auto. It's not documented 
as needed, it's not implied to be needed, and it isn't needed.


More information about the Digitalmars-d mailing list