ecma262 icon indicating copy to clipboard operation
ecma262 copied to clipboard

Editorial: Reduce redundant expressions in spec

Open jungwngkim opened this issue 4 weeks ago • 7 comments

This PR reduces the following redundant expressions in spec.

For each cases, the line below is merged with above one.

# 1. `emu-meta` tag
<emu-meta *>{{ name }}</emu-meta>({{ args }})
<emu-meta *>{{ name }}({{ args }})</emu-meta>


# 2. Replace redundant verbs
as specified in <emu-xref href="*"></emu-xref>
as described in <emu-xref href="*"></emu-xref>


# 3. Remove redundant adverbs
{{ expr }} has a {{ field }}
{{ expr }} also has a {{ field }}

{{ expr }} does not have a {{ field }}
{{ expr }} does not already have a {{ field }}

1. Append {{ expr }} to {{ expr }}.
1. Append {{ expr }} to the end of {{ expr }}.

The merging is based on the number of each cases. Smaller cases are merged to larger ones.

$ grep '1\. .*</emu-meta>(' spec.html -c
102
$ grep '1\. .*)</emu-meta>' spec.html -c
39
$ grep '1\. .* as specified in <emu-xref' spec.html -c
19
$ grep '1\. .* as described in <emu-xref' spec.html -c
2
$ grep '1\. .* has a \[\[.*\.' spec.html -c
57
$ grep '1\. .* also has a \[\[.*\.' spec.html -c
1
$ grep '1\. .* does not have a .*\.' spec.html -c
17
$ grep '1\. .* does not already have a .*\.' spec.html -c
3
$ grep '1\. Append .* to .*\.' spec.html -c
138
$ grep '1\. Append .* to the end of .*\.' spec.html
1

For reference, the number of line diff is 46 = 39 + 2 + 1 + 3 + 1.

jungwngkim avatar Nov 24 '25 03:11 jungwngkim

The rendered spec for this PR is available at https://tc39.es/ecma262/pr/3726.

github-actions[bot] avatar Nov 24 '25 03:11 github-actions[bot]

I disagree that these should generally be removed. While they may not make a technical difference, they help making the spec text easier to read; especially the adverbs have a meaning that convey an intention that would be otherwise be lost.

bergus avatar Nov 24 '25 06:11 bergus

The reason I’m proposing this PR is to ensure that the same expression/step/condition has the same form.

If you believe that the meaning is not preserved in the merged forms above, it would be helpful to suggest a consistent format for that expression/step/condition.

Also, regarding the adverbs you mentioned, I want to make a reminder that those forms are used max. 3 times throughout the entire spec.

"also" and "already" do not add any additional meaning, and since there's already a "prepend" step corrensponding to "append" step, "the end of" is redundant in this context.

jungwngkim avatar Nov 24 '25 06:11 jungwngkim

To me, "does not already have x" implies "… but will now get x", which makes sense in those precondition-assertions. But sure, these few occurrences are not worth arguing over.

bergus avatar Nov 24 '25 18:11 bergus

For the <emu-meta> tags, I think it makes more sense to consistently put the tags around the whole expression, since the effects arise from the whole expression not just the identifier. I think that should work fine with ecmarkup but can update it if not.

I don't like removing the "already"s. The technical meaning is the same either way but, like @bergus, I find it clearer and more natural to include the word in those cases. Unfortunately this is strictly a matter of English prose-writing, which is an aesthetic judgement, but nevertheless this is my opinion.

(The one "also" is in an awkward sentence anyway and so I am fine with dropping that particular instance.)

The removal of "to the end of" and changes from "described" to "specified" seem good.

bakkot avatar Nov 25 '25 00:11 bakkot

Thanks for the feedback.

To summarize, should I submit a PR that wraps the tags around the whole expression and keeps 'already' as is?

jungwngkim avatar Nov 28 '25 05:11 jungwngkim

@jungwngkim Please update this PR in that way.

michaelficarra avatar Nov 28 '25 06:11 michaelficarra