Octal escape sequences in string and regexp literals

Claude Pache claude.pache at gmail.com
Fri Jan 2 14:20:05 PST 2015

> Le 2 janv. 2015 à 22:08, Caitlin Potter <caitpotter88 at gmail.com> a écrit :
> (...)

> More important, octal escape sequences are a bit liberal, in that they
> can be of several lengths, with a pretty wide range of delimiters.
> This, I think, results in many cases where octal escape sequences are
> used by accident, rather than intentionally. It's a footgun, and
> ideally that footgun should not be there.

Concretely, the danger is that someone could write "\07" when they mean "\0" + "7". This is a good point. (Were you thinking of other cases when you wrote "many cases"?) 

> I feel like the "refactoring pain" argument is not very compelling,
> because I am not convinced beginners are likely to use octal literals
> on purpose (or even by accident).

I agree on that point, and therefore I didn't make any refactoring argument.


More information about the es-discuss mailing list