Octal escape sequences in string and regexp literals
claude.pache at gmail.com
Fri Jan 2 11:29:48 PST 2015
Current web browsers implement octal escape sequences of the form \52, representing the character of code 0o52, in string literals in sloppy mode only, and in regexps (at the condition there is less than 52 capturing groups) in both sloppy and strict mode.
(In order to avoid confusion: I am *not* concerned with legacy octal integer literals of the form: 052, representing the number 0o52.)
As far as I can infer from archives of es-discuss, these escape sequences was an undesired feature that was not standardised (in ES3), but that everyone implemented and was needed for web compatibility. So, it was decided to exclude it from ES5 strict mode, and therefore from Harmony which was thought to be built on strict mode, for 1JS wasn't invented back then.
Now, times have changed, and, in the sake of 1JS, new features are implemented in both sloppy and strict mode; or otherwise said, the difference between the two modes is kept as small as possible.
From that new perspective, is there still a strong enough reason to exclude these escape sequences from string literals in strict mode, that would justify the discrepency between strict and sloppy modes? And if so, what to do with regexps?
More information about the es-discuss