cplusplus / nbballot

Handling of NB comments in response to ballots
14 stars 4 forks source link

DE-114 26.7.23.2 [range.zip.view], 26.7.31 [range.cartesian] Const-breaking zip_view and cartesian_product_view #470

Closed wg21bot closed 1 year ago

wg21bot commented 1 year ago

The C++23 standard comes with views that now even break the effect of const when declaring elements:

std::vector v1{1,2,3};
std::vector v2{4,5,6};
for (const auto& [a, b] : std::views::zip(v1,v2)){
a = -1; // WTF const?
b = -1; // WTF const?
}
std::cout << v1[0] << '\n'; // prints -1

See https://godbolt.org/z/rKn9cqq93

Since C++ exists, we could teach the idiom that const makes objects const unless we have some strange declarations of generic types instantiated with references. But now C++23 breaks this idiom in features/fools for the mass. This breaks basic trust no const.

AFAIK, the only other view that has this same property is cartesian_product_view.

Fix this behavior (making the returned references const) or to remove zip_view and cartesian_product_view from the C++23 standard

brycelelbach commented 1 year ago

@inbal2l label this as Library Evolution when it's ready for us.

inbal2l commented 1 year ago

Scheduled for SG9's meeting in Kona, first session (08:00-9:45): https://wiki.edg.com/bin/view/Wg21kona2022/SG9

inbal2l commented 1 year ago

Reviewed by SG9 at Kona2022 meeting (Full Minutes).

Polls

__POLL: We support applying the first resolution of “DE#470: DE-114 26.7.23.2 (range.zip.view), 26.7.31 (range.cartesian) const-breaking zip_view and cartesian_product_view”, making the returned references const.__

SF F N A SA
0 0 0 2 8

Attendance: 14 (8 on-site, 6 online)

# of Authors: 0

Author’s position: n/a

Outcome: Strong consensus against

POLL: We support applying the second resolution of “DE#470: DE-114 26.7.23.2 (range.zip.view), 26.7.31 (range.cartesian) const-breaking zip_view and cartesian_product_view”, dropping zip_view and cartesian_product_view from C++23

SF F N A SA
0 0 0 0 10

Attendance: 14 (8 on-site, 6 online)

# of Authors: 0

Author’s position: n/a

Outcome: Strong consensus against

Summary

SG9 does not support accepting the resolution, since the solution proposed is not applicable considering the design constraints, and we don't believe that the issue presented justifies removing zip_view, cartisian_product_view, as it's a known issue in the language. The topic will be passed to LEWG for a final decision.

The issue was forwarded to LEWG.

brycelelbach commented 1 year ago

Did Library Evolution look at this at 2022-11 Kona?

inbal2l commented 1 year ago

Postponed to Issaquah because a major stakeholder wasn't present in the meeting.

brycelelbach commented 1 year ago

Ah right.

brycelelbach commented 1 year ago

2023-02-07 10:30 to 12:00 Issaquah Library Evolution Meeting

DE-114: Const-breaking zip_view and cartesian_product_view

2023-02-07 08:30 to 10:15 UTC-8 Issaquah Library Evolution Minutes

Champion: Nicolai Josuttis (R)

Chair: Bryce Adelstein Lelbach (IP) & Steve Downey (IP)

Minute Taker: Ben Craig (IP)

Start: 2023-02-07 08:35 UTC-8

__POLL: Remove zip_view and cartesian_product_view from C++23.__

Strongly Favor Weakly Favor Neutral Weakly Against Strongly Against
1 2 5 12 13

Attendance: 20 (in person) + 21 (remote)

# of Authors: 1

Author Position: SF

Outcome: Consensus against.

__POLL: Reject C++23 National Body comment DE-114 (Const-breaking zip_view and cartesian_product_view).__

Strongly Favor Weakly Favor Neutral Weakly Against Strongly Against
9 10 6 0 3

Attendance: 20 (in person) + 21 (remote)

# of Authors: 1

Author Position: Abstain

Outcome: Consensus in favor.

POLL: The const propagation problems described in DE-114 have merit and we should explore solutions to them in the future.

Strongly Favor Weakly Favor Neutral Weakly Against Strongly Against
18 10 3 0 1

Attendance: 20 (in person) + 21 (remote)

# of Authors: 1

Author Position: SA

Outcome: Consensus in favor.

SA: I don't think it's a good use of time. I worry that any fixes will make things more complicated.

End: 09:25

Next Steps

Reject C++23 National Body comment DE-114 because we have no consensus for change.

We believe the const propagation problems described in DE-114 have merit, and we should explore both language and library solutions to them in the future.

jensmaurer commented 1 year ago

Rejected. There is no consensus for a change.