ljharb / es-abstract

ECMAScript spec abstract operations.
MIT License
114 stars 30 forks source link

[Fix] `ES2016`+: `UTF16Decode` and friends, `CodePointAt`, `StringToCodePoints`: return numbers instead of strings #151

Closed mhassan1 closed 1 year ago

mhassan1 commented 1 year ago

This PR modifies the following operations to return numbers, as specified, instead of strings:

Resolves https://github.com/ljharb/es-abstract/issues/150.

ljharb commented 1 year ago

This would be a breaking change, so we can't make it for ES2022 or below, but we could accommodate it in ES2023+.

I'm still not clear on the problem here; the spec doesn't actually define "code point" or "code unit" as a string or as an integer, so I made a judgement call here. What's your use case where this came up?

mhassan1 commented 1 year ago

Given that it would be a breaking change for ES2022 and below, it probably doesn't make sense to change it for ES2023+. Closing this.

ljharb commented 1 year ago

It wouldn't be the first time - what I'd do in that case is leave the ES2016-2022 PR open in case we ever did a semver-major, and land the 2023+ changes in a separate PR. What's more important tho is discussing the rationale for the change; let's do that in the issue.

mhassan1 commented 1 year ago

As discussed in https://github.com/ljharb/es-abstract/issues/150, there's no rationale for the change. Thanks!