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

P1998 Simple Facility for Lossless Integer Conversion #720

Open
wg21bot opened this issue Dec 11, 2019 · 2 comments
Open

P1998 Simple Facility for Lossless Integer Conversion #720

wg21bot opened this issue Dec 11, 2019 · 2 comments
Labels
B3 - addition Bucket 3 as described by P0592: material that is not mentioned in P0592 LEWG Library Evolution needs-revision Paper needs changes before it can proceed numerics numerics-ts-1 SG6 Numerics TS Ship vehicle: TS

Comments

@wg21bot
Copy link
Collaborator

wg21bot commented Dec 11, 2019

P1998R0 Simple Facility for Lossless Integer Conversion (Ryan McDougall)

@wg21bot wg21bot added LEWGI Library Evolution Incubator SG6 Numerics labels Dec 11, 2019
@wg21bot wg21bot added this to the 2020-02 milestone Dec 11, 2019
@wg21bot
Copy link
Collaborator Author

wg21bot commented Jan 18, 2020

P1998R1 Simple Facility for Lossless Integer Conversion (Ryan McDougall)

@Cpp-Lisa
Copy link
Collaborator

Reviewed by SG6 Monday in Prague. We generally approve. The "narrow" naming caused some confusion about the intent and limitations of the function (e.g., can it be used to perform a strictly widening conversion?).

@brycelelbach
Copy link

Prague 2020-02 LEWGI Minutes

P1998R0 std::narrow[_cast]: Design Review

Chair: Billy Baker

Champion: Ryan McDougall

Minute Taker: David Olsen

Start Review: 2020-02-11 9:19

Implementation experience:

  • Yes, for everything but the compile time literals (explicit mention in paper).

Usage experience:

  • Yes, within Ryan's company (explicitly mention in paper).

Prior art:

  • boost::numeric_cast (add to paper).
  • gsl::narrow (add to paper).

convertible not convertable.

It seems novel that this proposal suggests that the noexcept narrow should specify that it terminates, instead of just saying UB on precondition failure.

narrow_or in its current form shouldn't be noexcept, under the current noexcept guidance.

Explore other prior art, such as gsl::narrow_cast.

Drop the literals?

Start Polling: 9:40

POLL: We should promise more committee time to pursuing P1998, knowing that our time is scarce and this will leave less time for other work.

Strongly For Weakly For Neutral Weakly Against Strongly Against
5 14 2 0 0

Attendance: 22

# of Authors: 1

Author Position: SF

POLL: For a lossless integer conversion, a solution that throws is desired (i.e. std::narrow_cast).

Strongly For Weakly For Neutral Weakly Against Strongly Against
4 8 4 1 0

Attendance: 22

# of Authors: 1

Author Position: Abstained

The consensus is that a solution that throws is desired.

POLL: For a lossless integer conversion, a solution that aborts the program in some manner is desired (i.e. std::narrow).

Strongly For Weakly For Neutral Weakly Against Strongly Against
1 5 7 3 2

Attendance: 22

# of Authors: 1

Author Position: SF

SA: Should not set precedent before contracts show up

N: Just the precondition would have been fine, but uncertain when contracts are not here

A: You can do this with std::narrow_or.

No consensus to provide a solution that aborts a program.

POLL: For a lossless integer conversion, a solution that allows invoking a Callable is desired (i.e. std::narrow_or).

Strongly For Weakly For Neutral Weakly Against Strongly Against
4 9 5 0 0

Attendance: 22

# of Authors: 1

Author Position: SF

The consensus is that a solution that allows invoking a Callable is desired.

POLL: For a lossless integer conversion, a solution that provides literal suffixes is desired.

Strongly For Weakly For Neutral Weakly Against Strongly Against
0 2 9 6 1

Attendance: 22

# of Authors: 1

Author Position: Not recorded

SA: I don't think it is fundamental to the proposal (could be added later)

WA: Teaching people to use both is harder than teaching a single context (i.e. the throwing one)

No consensus to provide literal suffixes.

End: 09:59

Consensus: LEWGI sends P1998R1 (Simple Facility for Lossless Integer Conversion), with the guidance below, to LEWG for the Numerics TS.

  • Remove the proposed solution that aborts a program (narrow).
  • Remove literal suffixes.

@brycelelbach brycelelbach added LEWG Library Evolution needs-revision Paper needs changes before it can proceed and removed LEWGI Library Evolution Incubator labels Feb 18, 2020
@jensmaurer jensmaurer removed this from the 2020-02 milestone Feb 18, 2020
@brycelelbach brycelelbach added B3 - addition Bucket 3 as described by P0592: material that is not mentioned in P0592 TS Ship vehicle: TS numerics-ts-1 labels Aug 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B3 - addition Bucket 3 as described by P0592: material that is not mentioned in P0592 LEWG Library Evolution needs-revision Paper needs changes before it can proceed numerics numerics-ts-1 SG6 Numerics TS Ship vehicle: TS
Projects
None yet
Development

No branches or pull requests

4 participants