cplusplus / cplusplus/draft

[intro.object]: the term "subobject" should consistently be either transitive or intransitive

Open
#2,310 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TeX
Stars
221
Forks
813
Avg merge
16h 4m
Merged PRs (30d)
36

Description

Also, the term "direct subobject" should be defined and/or [except.ctor]/3 should be fixed.

Richard Smith's answer to 'Is "subobject" a transitive relation?':

I think it depends on the context of the use, sadly. Strictly, subobject is
not transitive, and an object is only a subobject in at most one way (it
cannot be both an array element and a base class subobject, for instance),
notwithstanding that a virtual base class subobject can be a subobject of
multiple objects at once. Most uses of the term seem to use it in that way.

However, there are some uses that clearly intend to take the transitive
closure:

  • [basic.stc.dynamic.safety]/2.2 intends to allow transitive subobjects
    (but should probably allow all objects nested within the original object)
  • [basic.types]/3's example says "subobject" but presumably means
    something more general
  • [basic.type.qualifier]/1.1, /1.2, /1.3 have ambiguous antecedents and
    could be reworded to make it clearer that they are transitive ("of such an
    object" -> "of a const object").
  • [basic.start.static]/2 intends to allow transitive subobjects
  • [conv.ptr]/3 intends to allow anything in the transitive closure of
    "base class subobject of".
    ... and so on. (I'm sure you can find more.)

Feel like filing an editorial issue? We should aim to use the term
consistently.

From me:
[except.ctor]/3:
If the initialization or destruction of an object other than by delegating constructor is terminated by an exception, the destructor is invoked for each of the object's direct subobjects…
(Implies that subobjects can be indirect)

If the 'direct subobjects' here are '(immediate) base class subobjects' and 'member subobjects', what does it mean for members of an array type? How can a destructor be invoked for them? (Should I create another issue for this?)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review the uses of “subobject” in [intro.object], including [basic.stc.dynamic.safety]/2.2, [basic.types]/3, [basic.type.qualifier]/1.1–1.3, [basic.start.static]/2, and [conv.ptr]/3, then compare them with [except.ctor]/3. Done means the terminology consistently expresses either direct or transitive relationships, with “direct subobject” defined or [except.ctor]/3 corrected.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.