Join GitHub today
spec: don't say that 0123i == 123i is for backward-compatibility #36386
The Go Language Specification in https://golang.org/ref/spec#Imaginary_literals has the example
With the new number literal proposal implemented in
Probably the examples in https://golang.org/ref/spec#Integer_literals
should have a comment
The problem is that with the addition of the
But I admit that my text was confusing, sorry.
What I would like to propose is to deprecate the old syntax for octal literals. The specification should mention, in the examples, the old syntax only for reference but it should suggest the use of the new
I believe that it is already possible to use gofmt to rewrite old-style octal literals to new-style. I don't see a need to do anything else yet. Perhaps a few releases down the road we can deprecate the old-style octal literals, but not yet.
I think gofmt should not rewrite old-style octal literals to new-style, due to compatibility reason. Maybe it should be done by go fix?
IMHO, old-style octal literals should be rewritten to new-style in the standard library; and it should be done now, since there are no compatibility issue. Should I open a different issue?.
I agree that the deprecation should be done in future.
But, still, I'm not sure. Should all the official documents (excluding the spec) assume that the old-style octal literals never existed?