Code behaves incorrectly if it is compiled in std.functional
via Digitalmars-d
digitalmars-d at puremagic.com
Mon Jun 8 08:30:24 PDT 2015
On Monday, 8 June 2015 at 15:09:21 UTC, ketmar wrote:
> On Mon, 08 Jun 2015 15:47:33 +0200, Timon Gehr wrote:
>
>> On 06/08/2015 03:11 PM, ketmar wrote:
>>> so specifying two storage classes are sometimes valid and
>>> sometimes
>>> invalid. a perfect consistency!
>>
>> The compiler sometimes compiles the program and sometimes
>> terminates
>> with an error message instead. That's life.
>
> yeah. "you can't logically deduce it, you have to remember it!"
> that's
> the way to success.
That's only if you're talking about the details of the grammar.
But for everyday use (even advanced use!) of the language, these
are not important. You _don't_ "have to remember it", because you
simply don't need it. Noone forces you to write `auto const`, and
it gives you no advantages over just `const`. But if you really
feel an urge to use strange combinations of storage classes and
type modifiers, just do it, and the compiler will tell you
whether it's good or not. No need to remember anything. OTOH, if
you encounter such a combination in someone else's code, it's
still pretty obvious what it means. No problem there either.
More information about the Digitalmars-d
mailing list