Skip to content

Editorial: use idiomatic phrasing in CleanupFinalizationRegistry#3829

Open
michaelficarra wants to merge 3 commits intomainfrom
CleanupFinalizationRegistry-repeat-while
Open

Editorial: use idiomatic phrasing in CleanupFinalizationRegistry#3829
michaelficarra wants to merge 3 commits intomainfrom
CleanupFinalizationRegistry-repeat-while

Conversation

@michaelficarra
Copy link
Copy Markdown
Member

No description provided.

@bakkot
Copy link
Copy Markdown
Member

bakkot commented Apr 9, 2026

I find this more awkward to read FWIW.

@michaelficarra
Copy link
Copy Markdown
Member Author

@bakkot How about this?

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 9, 2026

The rendered spec preview for this PR is available as a single page at https://tc39.es/ecma262/pr/3829 and as multiple pages at https://tc39.es/ecma262/pr/3829/multipage .

@bakkot
Copy link
Copy Markdown
Member

bakkot commented Apr 9, 2026

Still just as awkward. Compare the before and after as prose rather than pretending it's a computer program. The earlier prose is much easier to understand.

@michaelficarra
Copy link
Copy Markdown
Member Author

The step Choose any such _cell_. is what bothers me about the before. How would you phrase that to not use an alias that should only be visible to the "contains"?

@bakkot
Copy link
Copy Markdown
Member

bakkot commented Apr 9, 2026

I don't understand what bothers you about it. That is a totally normal phrasing.

@michaelficarra
Copy link
Copy Markdown
Member Author

The phrasing is fine. It's just in this case it's referring to an alias that I don't think it should be able to refer to. I don't consider the form in the while step to be declaring an alias that is visible to later steps.

@bakkot
Copy link
Copy Markdown
Member

bakkot commented Apr 9, 2026

Well, that is how prose works.

Copy link
Copy Markdown
Member

@nicolo-ribaudo nicolo-ribaudo left a comment

Choose a reason for hiding this comment

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

The phrasing is fine. It's just in this case it's referring to an alias that I don't think it should be able to refer to. I don't consider the form in the while step to be declaring an alias that is visible to later steps.

Instead of Choose any such _cell_ we could use Let _cell_ be any of such Records, so that it's declaring _cell_ and not referencing the one "declared" in the While prose that has not one value but many possible values.

Comment thread spec.html
Comment on lines +12562 to +12563
1. Let _candidates_ be a List whose elements are the elements of _finalizationRegistry_.[[Cells]] whose [[WeakRefTarget]] is ~empty~.
1. If _candidates_ is empty, return ~unused~.
Copy link
Copy Markdown
Member

@nicolo-ribaudo nicolo-ribaudo Apr 10, 2026

Choose a reason for hiding this comment

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

Suggested change
1. Let _candidates_ be a List whose elements are the elements of _finalizationRegistry_.[[Cells]] whose [[WeakRefTarget]] is ~empty~.
1. If _candidates_ is empty, return ~unused~.
1. Let _cell_ be either ~none~ or one of the elements of _finalizationRegistry_.[[Cells]] whose [[WeakRefTarget]] is ~empty~, chosen in an implementation-defined manner.
1. If _cell_ is ~none~, return ~unused~.
1. Remove _cell_ from _finalizationRegistry_.[[Cells]].
1. Perform ? HostCallJobCallback(_callback_, *undefined*, « _cell_.[[HeldValue]] »).

Would this make it easier to follow, with a similar readability as the original prose?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants