-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Description
Shortly
Proposal is to add an alternative syntax for representing octal literals and deprecate the current syntax in Go 2+. Deprecation is not necessary, but is personally perceived to be inline with Go's idioms
Current syntax: octal_lit = "0" { octal_digit } .
Proposed change: octal_lit = "0o" { octal_digit } .
Background
The idea is directly borrowed from CoffeeScript, where the feature exists to help developers to avoid various typos in their code:
- Missed
xin0x1234 - Missed
.after0in0.1234 - Missed
.before0in.01234 - Extra leading
0in decimal literal as in01234
Personal view on the current syntax
I think that the current syntax for octal literals is outdated and was simply copied from ancestor languages, because the problem it introduced there was not evident. This proposal may very well be rejected on the grounds of Go 1 compatibility promise assesment, but I guess it is good to keep the pressure for a change.