On Wednesday, 20 June 2012 at 17:59:08 UTC, ixid wrote:

Just as a question about the existing syntax as you listed combinations to learn as a negative:

auto name = initializer;
const name = initializer;
immutable name = initializer;
shared name = initializer;
enum name = initializer;

After the first aren't these all just short hand for "const auto name = init" etc with the given keyword?

No. Many don't realise this, but "auto" doesn't actually stand for "automatic type inference". It is a storage class, like static, extern, etc., and it means that the variable stops existing at the end of the scope. It is, however, the default storage class, which is why it is useful when all you want is type inference. Even C has auto.

Lars

Reply via email to