Title
Library wording uses "initializes x with y", which is underspecified
Status
new
Section
[pairs.pair][tuple.cnstr][variant.ctor] [util.smartptr.atomic.shared][allocator.adaptor.cnstr] [format.parse.ctx][format.arg][container.adaptors] [predef.iterators][range.subrange.ctor][range.factories] [range.adaptors][numeric.ops][time.hms] [re.iter][atomics.types.generic][atomics.nonmembers] [thread.stoptoken][thread.threads][thread.mutex] [thread.sema][thread.coord][futures]
Submitter
Richard Smith

Created on 2019-11-21.00:00:00 last changed 61 months ago

Messages

Date: 2019-12-08.00:00:00

[ 2019-12-08 Issue Prioritization ]

Priority to 3 after reflector discussion.

Date: 2019-11-21.00:00:00

The problem was discussed here:

It seems to me that this is just one instance of a systemic problem in the library wording. This phrasing "initializes x with y" is common, but underspecified (and formally meaningless) — the library wording either needs to say what kind of initialization is performed, or specify an initializer (not an expression) with which to initialize. We should ask LWG to think about this; for each "initializes x with y" utterance, the reader should know what kind of initialization we mean.

Looking at random through the library wording, the first case I found: [queue.cons]/1:

Effects: Initializes c with cont.

The meaning of this depends on whether this is direct- or copy-initialization. (It's obscure, but if T is not Cpp17CopyInsertable into the container, it could be the case that one form of initialization works and the other does not, or that they both work and do different things.)

Another random sample: [partial.sum]/2:

Effects: For a non-empty range, the function creates an accumulator acc whose type is InputIterator's value type, initializes it with *first, and assigns the result to *result.

Again the difference between direct- and copy-initialization is observable here.

Perhaps the library should have blanket wording that when it says "initializes", it means by direct- or copy-initialization, and that it's unspecified which one you get (or something like that) — and someone should go through all the instances and check if any of them mean something else (I doubt this is the only case that does).

Suggestion: either

  • add blanket wording defining what you mean when you say "initializes x with y" (e.g., it's unspecified whether copy-initialization or direct-initialization is performed) and make sure that that's what's intended for all uses, or

  • stop using the "initializes x with y" formulation entirely, and specify the kind of initialization on each use, or

  • for each such use, ensure that y is an initializer (that is, of the form "= expr" or "(expr, expr, …)" or "= { … }" or "{ … }", and not merely an expression)

History
Date User Action Args
2019-12-08 18:50:22adminsetmessages: + msg10874
2019-11-21 00:00:00admincreate