-
Notifications
You must be signed in to change notification settings - Fork 17.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
spec: don't say that 0123i == 123i is for backward-compatibility #36386
Comments
Assuming that, theoretically, leading zeros in decimal integer literals should not permitted (as it is done in Python 3), then the comment in the first example should remain, and the same comment should be added in the second example. |
I think the spec is correct. On the other hand, |
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 |
CC @griesemer 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? Thanks. |
The Go Language Specification in https://golang.org/ref/spec#Imaginary_literals has the example
With the new number literal proposal implemented in
Go 1.13
, I think the comment should be changed, since now it is0123 == 0o123
that should be considered to be for backward-compatibility.Probably the examples in https://golang.org/ref/spec#Integer_literals
should have a comment
// == 0o600 for backward-compatibility
.The text was updated successfully, but these errors were encountered: