Skip to content
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

[spec] hex-escape punctuators #67

Merged
merged 1 commit into from
Mar 25, 2024
Merged

[spec] hex-escape punctuators #67

merged 1 commit into from
Mar 25, 2024

Conversation

ljharb
Copy link
Member

@ljharb ljharb commented Mar 22, 2024

Fixes #65

spec.emu Outdated Show resolved Hide resolved
spec.emu Outdated Show resolved Hide resolved
spec.emu Outdated Show resolved Hide resolved
spec.emu Outdated Show resolved Hide resolved
spec.emu Outdated Show resolved Hide resolved
spec.emu Outdated Show resolved Hide resolved
spec.emu Show resolved Hide resolved
@ljharb ljharb requested a review from bakkot March 25, 2024 20:03
spec.emu Outdated Show resolved Hide resolved
spec.emu Outdated
</h1>
<dl class="header">
<dt>description</dt>
<dd>If the code unit represents a RegExp punctuator that needs escaping, or ASCII whitespace, it produces the code units for *"\x"* followed by the relevant escape code. If the code unit represents non-ASCII white space, it produces the code units for *"\u"* followed by the relevant escape code. Otherwise, it returns a List containing the original code unit.</dd>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<dd>If the code unit represents a RegExp punctuator that needs escaping, or ASCII whitespace, it produces the code units for *"\x"* followed by the relevant escape code. If the code unit represents non-ASCII white space, it produces the code units for *"\u"* followed by the relevant escape code. Otherwise, it returns a List containing the original code unit.</dd>
<dd>If _c_ represents a RegExp punctuator that needs escaping or ASCII whitespace, it produces the code points for *"\x"* followed by the relevant escape code. If _c_ represents non-ASCII white space, it produces the code points for *"\u"* followed by the relevant escape code. Otherwise, it returns a singleton List containing _c_.</dd>

Copy link
Member Author

@ljharb ljharb Mar 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The _c_ replacements seem good, done; but i think the comma is necessary for it to read properly, and what is a "singleton" List vs any other kind of List?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A singleton list has one element. This is to be explicit that it's not any old list that contains c (and possibly other things) but the list that contains only c.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a really confusing word to use to me; in JS a singleton is when you have a class with a single shared instance. Is that qualifier necessary, given that it already says "a List containing c"?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not necessary, I just thought it was a cheap way to be more precise. https://en.wikipedia.org/wiki/Singleton_(mathematics)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see how it adds precision, since the prose already explicitly says it has one item in it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where does it say that?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't "Otherwise, it returns a List containing the original code unit" that?

either way i'd like to land this, and i'm happy to have a PR tweaking it further, or we can do it at 262 time.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't "Otherwise, it returns a List containing the original code unit" that?

I still don't know where this prose you're referring to is.

[a] is a list containing a, and is also a singleton list containing a. [a, b] is another list containing a, but is not a singleton list.

Anyway, it's not important, but for me it seemed like an easy win for precision.

spec.emu Outdated Show resolved Hide resolved
Copy link
Member

@michaelficarra michaelficarra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM otherwise.

@ljharb ljharb merged commit f01c310 into main Mar 25, 2024
2 checks passed
@ljharb ljharb deleted the hex-escapes branch March 25, 2024 21:20
Vylpes pushed a commit to Vylpes/Droplet that referenced this pull request May 28, 2024
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [core-js](https://github.com/zloirock/core-js) | dependencies | minor | [`3.36.1` -> `3.37.1`](https://renovatebot.com/diffs/npm/core-js/3.36.1/3.37.1) |

---

### Release Notes

<details>
<summary>zloirock/core-js (core-js)</summary>

### [`v3.37.1`](https://github.com/zloirock/core-js/blob/HEAD/CHANGELOG.md#3371---20240514)

[Compare Source](zloirock/core-js@v3.37.0...v3.37.1)

-   Changes [v3.37.0...v3.37.1](zloirock/core-js@v3.37.0...v3.37.1)
-   Fixed [`URL.parse`](https://url.spec.whatwg.org/#dom-url-parse) feature detection for some specific cases
-   Compat data improvements:
    -   [`Set` methods proposal](https://github.com/tc39/proposal-set-methods) added and marked as [supported from FF 127](https://bugzilla.mozilla.org/show_bug.cgi?id=1868423)
    -   [`Symbol.dispose`](https://github.com/tc39/proposal-explicit-resource-management) added and marked as supported from V8 ~ Chromium 125
    -   [`Math.f16round` and `DataView.prototype.{ getFloat16, setFloat16 }`](https://github.com/tc39/proposal-float16array) added and marked as [supported from Deno 1.43](denoland/deno#23490)
    -   [`URL.parse`](https://url.spec.whatwg.org/#dom-url-parse) added and marked as [supported from Chromium 126](https://chromestatus.com/feature/6301071388704768)
    -   [`URL.parse`](https://url.spec.whatwg.org/#dom-url-parse) added and marked as [supported from NodeJS 22.0](nodejs/node#52280)
    -   [`URL.parse`](https://url.spec.whatwg.org/#dom-url-parse) added and marked as [supported from Deno 1.43](denoland/deno#23318)
    -   Added [Rhino 1.7.15](https://github.com/mozilla/rhino/releases/tag/Rhino1\_7\_15\_Release) compat data, many features marked as supported
    -   Added [NodeJS 22.0](https://nodejs.org/en/blog/release/v22.0.0) compat data mapping
    -   Added [Deno 1.43](https://github.com/denoland/deno/releases/tag/v1.43.0) compat data mapping
    -   Added Electron 31 compat data mapping
    -   Updated [Opera Android 82](https://forums.opera.com/topic/71513/opera-for-android-82) compat data mapping
    -   Added Samsung Internet 26 compat data mapping
    -   Added Oculus Quest Browser 33 compat data mapping

### [`v3.37.0`](https://github.com/zloirock/core-js/blob/HEAD/CHANGELOG.md#3370---20240417)

[Compare Source](zloirock/core-js@v3.36.1...v3.37.0)

-   Changes [v3.36.1...v3.37.0](zloirock/core-js@v3.36.1...v3.37.0)
-   [New `Set` methods proposal](https://github.com/tc39/proposal-set-methods):
    -   Built-ins:
        -   `Set.prototype.intersection`
        -   `Set.prototype.union`
        -   `Set.prototype.difference`
        -   `Set.prototype.symmetricDifference`
        -   `Set.prototype.isSubsetOf`
        -   `Set.prototype.isSupersetOf`
        -   `Set.prototype.isDisjointFrom`
    -   Moved to stable ES, [April 2024 TC39 meeting](tc39/proposals@bda5a6b)
    -   Added `es.` namespace modules, `/es/` and `/stable/` namespaces entries
-   [Explicit Resource Management stage 3 proposal](https://github.com/tc39/proposal-explicit-resource-management):
    -   Some minor updates like [explicit-resource-management/217](tc39/proposal-explicit-resource-management#217)
-   Added [`Math.sumPrecise` stage 2.7 proposal](https://github.com/tc39/proposal-math-sum/):
    -   Built-ins:
        -   `Math.sumPrecise`
-   [`Promise.try` proposal](https://github.com/tc39/proposal-promise-try):
    -   Built-ins:
        -   `Promise.try`
    -   Added optional arguments support, [promise-try/16](tc39/proposal-promise-try#16)
    -   Moved to stage 2.7, [April 2024 TC39 meeting](tc39/proposals@301fc9c)
-   [`RegExp.escape` stage 2 proposal](https://github.com/tc39/proposal-regex-escaping):
    -   Moved to hex-escape semantics, [regex-escaping/67](tc39/proposal-regex-escaping#67)
        -   It's not the final change of the way of escaping, waiting for [regex-escaping/77](tc39/proposal-regex-escaping#77) soon
-   [Pattern matching stage 1 proposal](https://github.com/tc39/proposal-pattern-matching):
    -   Built-ins:
        -   `Symbol.customMatcher`
    -   Once again, [the used well-known symbol was renamed](tc39/proposal-pattern-matching#295)
    -   Added new entries for that
-   Added [Extractors stage 1 proposal](https://github.com/tc39/proposal-extractors):
    -   Built-ins:
        -   `Symbol.customMatcher`
    -   Since the `Symbol.customMatcher` well-known symbol from the pattern matching proposal is also used in the exactors proposal, added an entry also for this proposal
-   Added [`URL.parse`](https://url.spec.whatwg.org/#dom-url-parse), [url/825](whatwg/url#825)
-   Engines bugs fixes:
    -   Added a fix of [Safari `{ Object, Map }.groupBy` bug that does not support iterable primitives](https://bugs.webkit.org/show_bug.cgi?id=271524)
    -   Added a fix of [Safari bug with double call of constructor in `Array.fromAsync`](https://bugs.webkit.org/show_bug.cgi?id=271703)
-   Compat data improvements:
    -   [`URL.parse`](https://url.spec.whatwg.org/#dom-url-parse) added and marked as supported [from FF 126](https://bugzilla.mozilla.org/show_bug.cgi?id=1887611)
    -   [`URL.parse`](https://url.spec.whatwg.org/#dom-url-parse) added and marked as supported [from Bun 1.1.4](oven-sh/bun#10129)
    -   [`URL.canParse`](https://url.spec.whatwg.org/#dom-url-canparse) fixed and marked as supported [from Bun 1.1.0](oven-sh/bun#9710)
    -   [New `Set` methods](https://github.com/tc39/proposal-set-methods) fixed in JavaScriptCore and marked as supported from Bun 1.1.1
    -   Added Opera Android 82 compat data mapping

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4wLjAiLCJ1cGRhdGVkSW5WZXIiOiIzNy4wLjAiLCJ0YXJnZXRCcmFuY2giOiJkZXZlbG9wIn0=-->

Reviewed-on: https://git.vylpes.xyz/RabbitLabs/Droplet/pulls/306
Co-authored-by: Renovate Bot <renovate@vylpes.com>
Co-committed-by: Renovate Bot <renovate@vylpes.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

change escaping to hex escape sequences
5 participants