Constant_declarations spec

(mohammed) #1


According to the grammar defined in the link above, the statement ‘const toto’ could compile (or in other words, is idiomatic) . This is wrong and thanks God the Golang indeed throw a compilation error.


(Johan Dahl) #2

It is valid if it comes after another declaration. See these examples


(mohammed) #3

Yes, indeed.

But, like I said, the statement “const toto” is considered valid based on the grammar, which is wrong in practice.

This snippet is not working, but the constant_declartions section says it’s valid.