Skip to content

Conversation

@AlisdairM
Copy link
Contributor

@AlisdairM AlisdairM commented Jul 28, 2024

The definition of program at the top of [basic.link] should move to the front of [lex.separate] so that it is defined before its first usage, and also clarifies what the phases of translation produce.

The description of translation unit in [basic.link] is provided only to support the definition of program. However, that description is no longer useful now that the term has a definition in [lex.phases]. The description is also never referenced In the rest of [basic.link]. If we remove that description, then there is nothing tying the definition of the grammar term translation-unit to [basic.link] either, so move it to the place where that definition is most useful, at the top of [module.unit][basic.def]. It is tempting to move the grammar definitions of global-module-framgment and private-module-framgment to the collected grammar at the top of this clause two, but leaving them in their current subclauses for now, pending further feedack.

Finally, retitle [basic.link] as just Linkage, rather than Programs and linkage, as the subclause was never about the terms described in the opening paragraph and never mention again (within this clause).

@AlisdairM
Copy link
Contributor Author

Just to confirm that I looked at every reference for program and translation unit to see if they had a cross reference that should be updated. These terms occur quite frequently, but rarely have a cross-reference, and in those places that do have a cross reference, they are frequently cross referencing a concept in the whole sentence rather than a definition of either term.

@AlisdairM AlisdairM force-pushed the move_definition_of_program branch 2 times, most recently from 86d979a to 413da6a Compare October 23, 2024 12:54
@AlisdairM
Copy link
Contributor Author

Note to CWG chair: this PR, if accepted, would seem to be making progress towards resolving http://wg21.link/cwg2670.

@wg21bot wg21bot added the needs rebase The pull request needs a git rebase to resolve merge conflicts. label Jul 24, 2025
@AlisdairM AlisdairM force-pushed the move_definition_of_program branch from 413da6a to be3e611 Compare August 1, 2025 12:17
@AlisdairM AlisdairM force-pushed the move_definition_of_program branch 2 times, most recently from ed14973 to 6b5b3b1 Compare August 24, 2025 17:00
@jensmaurer jensmaurer removed the needs rebase The pull request needs a git rebase to resolve merge conflicts. label Aug 24, 2025
Comment on lines 9 to 12
\nontermdef{translation-unit}\br
\opt{declaration-seq}\br
\opt{global-module-fragment} module-declaration \opt{declaration-seq} \opt{private-module-fragment}

Copy link
Member

Choose a reason for hiding this comment

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

A translation-unit is not necessarily a module unit, so I find this new place not good. I agree having this production in [lex] is not good, either, because this is a phase 7 grammar production. I agree that [basic.link] isn't a great place, so it's either [basic.pre] or a new subclause [basic.program].

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looking again, I think the best location is to introduce [basic.def]. What you you think?

@AlisdairM AlisdairM force-pushed the move_definition_of_program branch from 6b5b3b1 to 3f83595 Compare August 25, 2025 13:28
@AlisdairM AlisdairM requested a review from jensmaurer August 25, 2025 13:28
@AlisdairM AlisdairM force-pushed the move_definition_of_program branch from 3f83595 to 1a45c36 Compare October 25, 2025 23:44
@AlisdairM
Copy link
Contributor Author

Rebased with wording better targeted at relevant clauses, and clearly addressing a resolution to CWG2670.

…on unit

The definition of program at the top of [basic.link] should move to
the front of [lex.separate] so that it is defined before its first
usage, and also clarifies that is what the phases of translation produce.

Similarly, move the definition of the grammar production translation-unit
to the top of [basic.def] which contains the practical definition.

Finally, retitle [basic.link] as just Linkage, rather than
Programs and linkage.
@AlisdairM AlisdairM force-pushed the move_definition_of_program branch from 1a45c36 to 7dc1d8a Compare November 13, 2025 17:07
@jensmaurer
Copy link
Member

This does more than moving stuff around (which makes review harder), and will have a merge conflict with the approved CWG3091.

@AlisdairM
Copy link
Contributor Author

Note that it does apply the resolution to CWG3091 in the words that it moves. Other than moving words --- one paragraph split into two locations --- it updates all relevant links to where the words used to occur. Some of those cross-references are simply removed, not redirected, as the words land close to the location that was making a cross-reference.

I believe the only other change I made was to drop "Programs and" from the subclause header "Programs and linkage", without touching any of the stable labels.

I also believe the new locations for both definitions are much more suited than where they were, or I would not have submitted the PR ;)

@AlisdairM
Copy link
Contributor Author

I also expect to push an update with conflict resolution after the Kona motions land.

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.

3 participants