-
Notifications
You must be signed in to change notification settings - Fork 32
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
change escaping to hex escape sequences #65
Comments
What's the argument for doing this, other than the polyfilling thing? |
Less RegExp grammar complexity. While I still assert that nobody should be reading the output of |
I'd prefer to encounter |
I agree; I would expect developers are quite comfortable with a backslash being a noop for the character, whereas hex escapes would be wildly unfamiliar. |
As a lay person, if I may, I've got some questions. Punctuator escapinga) As hex
b) As human readable characters
Potential additional complexityIt sounds to me like a one or two line change, with a lookup table or equivalent for current punctuators, is that a fair assessment? Or is considerably more complex to produce one over the other? Other questions
PreferenceI'm in favour of whichever is simpler. I'd be happy if anything that impedes the progress of |
@oliverfoster this can’t be parked for later; it has to be decided before the feature ships and likely can never be changed in the future. Spec complexity will likely be about the same with either approach; a line or two of grammar vs a line or two to do the hex escape. |
I feel like pollyfill for older browsers is more important, and there can always be a function to translate hex codes into backslash escaped characters |
We don't generally make changes to proposals solely due to polyfillability. |
Rough consensus was to make this change; I'll do that, and then come back in a future meeting to seek stage 2.7. |
Couple comments:
|
Filed #67. Currently goes with lowercase. |
The Encode AO (currently used by
|
True, but the base64 proposal uses lowercase, as does Number.prototype.toString. |
There's no need to add complexity of single-character identity escapes for every ASCII punctuator. I would prefer escaping using hex escape sequences instead, as discussed in #58. The only argument given against this is that you'd have to copy-paste any RegExp constructed using this function into a RegExp explainer to understand it, but let's be honest, you were going to have to do that anyway. @sophiebits also points out that by not modifying the grammar, we allow this feature to be polyfilled in older browsers.
The text was updated successfully, but these errors were encountered: