Closed atilaneves closed 8 years ago
I can confirm this to be the case, I hadn't noticed before. However, I think the problem is that auto and immutable are wrong rather than const being wrong: const is listed as a modifier so it's behaviour is as it should be in some sense, auto and immutable are hacked in a special hack rather than being handled by the standard mechanisms.
It would seem then that we should remove const from it's modifier status and add it to the specially hacked along with auto and immutable. I guess the questions are whether auto, immutable and const are identical as symbols and so should be treated the same, and will anything break by making such a change.
I suggest we might benefit from wider debate on this one?
Well, there's also the complication that this is valid:
const auto foo = 4;
immutable auto bar = 4;
I don't mind the debate, but for me when const
and immutable
show up by themselves I'd expect them to be font-locked as types. In any case, the variable being highlighted properly is the most important issue to me.
auto foo = getFoo()
andimmutable foo = getFoo()
highlightfoo
as a new variable introduction (as it should) butconst foo = getFoo()
highlightsfoo
as a type (expecting something likeconst Foo foo
).