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

Editorial: Update clause range references #2133

Merged
merged 1 commit into from
Aug 20, 2020

Conversation

gibson042
Copy link
Contributor

The "Managing Memory" clause inserted by 71c0897 broke some clause range references. We might want a more automated way to catch this, but such restructuring is rare and in the meantime it's just a handful of changes to merge.

@bakkot
Copy link
Contributor

bakkot commented Aug 11, 2020

Nice catch.

We might want a more automated way to catch this

Yeah, if you replace clause 6 with clause <emu-xref href="#sec-ecmascript-data-types-and-values"></emu-xref> (or whatever), then the references can't get stale. The emu-xref will turn into a link whose text is the number of the clause (here "6") and whose target is the actual clause.

I think that's probably better than updating the numbers manually. Do you want to do update all the explicit references to clause numbers yourself? I can take care of it otherwise.

spec.html Outdated Show resolved Hide resolved
spec.html Show resolved Hide resolved
@gibson042
Copy link
Contributor Author

Yeah, if you replace clause 6 with clause <emu-xref href="#sec-ecmascript-data-types-and-values"></emu-xref> (or whatever), then the references can't get stale. The emu-xref will turn into a link whose text is the number of the clause (here "6") and whose target is the actual clause.

References wouldn't get stale, but it'd still be baking in an assumption that the relevant clauses appear in order and fully encompass the standard library (which would be violated if a standard library section is added before The Global Object or after Reflection, or if either of those move). It would be best if there were a single link target, but I understand not wanting to incur the additional depth hit for what is probably the most popular 40% of the spec (or wait for TOC construction changes supporting subsection promotion).

Given the above, do you still want the explicit references?

@bakkot
Copy link
Contributor

bakkot commented Aug 12, 2020

It would be best if there were a single link target

I'm not sure what you're suggesting here; can you sketch an example?

Given the above, do you still want the explicit references?

Yeah, I think emu-xrefs are a strict improvement over writing out the numbers explicitly, even though they don't solve all issues.

@jmdyck
Copy link
Collaborator

jmdyck commented Aug 12, 2020

It would be best if there were a single link target

I'm not sure what you're suggesting here; can you sketch an example?

E.g., if you took clauses "The Global Object" through "Reflection" and made them children of a new emu-clause (called, say, "The ECMAScript Standard Library"), then you could xref to that one clause rather than to "clauses 17 through 27".

@jmdyck
Copy link
Collaborator

jmdyck commented Aug 12, 2020

There are also clause-range references in 4.5 Organization of This Specification.

@gibson042
Copy link
Contributor Author

Thanks for that find, @jmdyck. @bakkot I've replaced the literal clause numbers with <emu-xref>s.

spec.html Show resolved Hide resolved
Copy link
Contributor

@bakkot bakkot left a comment

Choose a reason for hiding this comment

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

Thanks much! I'll add a lint rule against for [Cc]lauses? \d at some point so we don't risk having this problem again.

@ljharb ljharb requested a review from a team August 13, 2020 23:15
@ljharb ljharb self-assigned this Aug 13, 2020
@@ -541,7 +541,7 @@ <h1>The Syntactic Grammar</h1>
</emu-note>
<emu-note>Parse Nodes are specification artefacts, and implementations are not required to use an analogous data structure.</emu-note>
<p>Productions of the syntactic grammar are distinguished by having just one colon &ldquo;<b>:</b>&rdquo; as punctuation.</p>
<p>The syntactic grammar as presented in clauses 12, 13, 14 and 15 is not a complete account of which token sequences are accepted as a correct ECMAScript |Script| or |Module|. Certain additional token sequences are also accepted, namely, those that would be described by the grammar if only semicolons were added to the sequence in certain places (such as before line terminator characters). Furthermore, certain token sequences that are described by the grammar are not considered acceptable if a line terminator character appears in certain &ldquo;awkward&rdquo; places.</p>
<p>The syntactic grammar as presented in clauses <emu-xref href="#sec-ecmascript-language-expressions"></emu-xref> through <emu-xref href="#sec-ecmascript-language-scripts-and-modules"></emu-xref> is not a complete account of which token sequences are accepted as a correct ECMAScript |Script| or |Module|. Certain additional token sequences are also accepted, namely, those that would be described by the grammar if only semicolons were added to the sequence in certain places (such as before line terminator characters). Furthermore, certain token sequences that are described by the grammar are not considered acceptable if a line terminator character appears in certain &ldquo;awkward&rdquo; places.</p>
Copy link
Member

Choose a reason for hiding this comment

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

I'd rather list them out instead of using a range. Now we're dependent on the clause ordering. If we list them out, we can re-order clauses all we want without breaking these references.

Copy link
Contributor

@bakkot bakkot Aug 16, 2020

Choose a reason for hiding this comment

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

@michaelficarra We'd still need to update this sentence because such a reordering would result in these being listed out of order.

More generally, I think readability ought to take precedence over maintainability (especially for things which rarely require maintenance, as here), and I think "as presented in clauses 12 through 15" is more readable than "as presented in clauses 12, 13, 14, and 15", so I would prefer to keep the current PR's wording.

Copy link
Member

Choose a reason for hiding this comment

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

I will reluctantly accept this change since it is easy and doesn't make things worse. For posterity, my preference would be to list out an <emu-xref> for each clause, and when ecmarkup sees that they represent a range, it could render it as we see here. This would address the issues of finding occurrences of the clause ID within the source and including the reference in a clause's reference list. But the other editors don't agree it's worthwhile.

@michaelficarra michaelficarra added the editor call to be discussed in the next editor call label Aug 17, 2020
@michaelficarra michaelficarra removed the editor call to be discussed in the next editor call label Aug 19, 2020
@ljharb ljharb force-pushed the 2020-08-clause-ref-update branch from c8387b8 to 93ac768 Compare August 20, 2020 00:10
@ljharb ljharb merged commit 93ac768 into tc39:master Aug 20, 2020
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.

6 participants