Attribute inference for auto functions?

Andrej Mitrovic andrej.mitrovich at gmail.com
Wed Apr 17 05:46:38 PDT 2013


On 4/17/13, Peter Alexander <peter.alexander.au at gmail.com> wrote:
> Type inference happens if and only if you do
> not specify a return type.

That's not true, you still need to use auto. This function definition
is illegal:

x() { return 1; }

As for being able to use 'const' for type inference it's completely an
implementation issue. It's not by design at all. You can even
substitute 'auto' for meaningless crap like this in module scope:

static x() { return 1; }

If return type inference is wanted then 'auto' should be required at
all times. What's the point in writing obfuscated code like the above?


More information about the Digitalmars-d mailing list