Switching absl::optional to std::optional

330 views
Skip to first unread message

David Benjamin

unread,
Sep 21, 2023, 2:33:52 PM9/21/23
to cxx, Victor Vasiliev, b...@chromium.org, Dana Jansens, Daniel Cheng
Hi all,

I'd like to propose we switch absl::optional to std::optional. Details here:
https://docs.google.com/document/d/1AW7q9HCLOk738OCj8Z2U_AKVUC0YIFZWuyRvv09XTHk/edit?usp=sharing

In particular, there is an open question in there as to which of two paths to take, depending on how we feel about binary size vs debuggable crash dumps in this context. But otherwise, I think the switch is clear.

Thoughts?

David

Peter Kasting

unread,
Sep 25, 2023, 12:13:54 PM9/25/23
to David Benjamin, cxx, Victor Vasiliev, b...@chromium.org, Dana Jansens, Daniel Cheng
While the crash dump route issue is still an open discussion, it seems like we should be able to eventually converge on an answer there, and the fundamental issue is broader than, and somewhat orthogonal to, the question of absl::optional vs. std::optional itself.

I don't see any other reason not to do this. +1 from me to switching over once the crash issue has alignment.

I would also like to publicly thank you for the time and effort you've been putting in to investigate these fundamental type switches. It's not glamorous work and most developers don't perceive much immediate benefit, but each one removed is one less hurdle for a new contributor to learn, one less case of impedance mismatches for a third-party library to convert, and one more case where we more deeply understand the tradeoffs we're making with our type choices. Sincere thanks, David, for the slog.

PK

Dana Jansens

unread,
Sep 26, 2023, 10:23:05 AM9/26/23
to Peter Kasting, David Benjamin, cxx, Victor Vasiliev, b...@chromium.org, Daniel Cheng
+1 to what Peter said, and to moving to std::optional.

David Benjamin

unread,
Sep 26, 2023, 3:32:05 PM9/26/23
to Dana Jansens, Peter Kasting, cxx, Victor Vasiliev, b...@chromium.org, Daniel Cheng
Thanks! And thanks to you two for always being on hand to discuss language issues!

Sounds like the consensus on the doc is to pick option 1. If there aren't objections, I'll send the CL out for review late this week or early next week.

Nico Weber

unread,
Sep 29, 2023, 10:50:56 AM9/29/23
to David Benjamin, Dana Jansens, Peter Kasting, cxx, Victor Vasiliev, b...@chromium.org, Daniel Cheng
As mentioned on chat a while ago, +1 to option 1 (I added to the thread in the doc), and +1 thank you for doing this and the thorough writeup :)

--
You received this message because you are subscribed to the Google Groups "cxx" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cxx+uns...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/cxx/CAF8qwaCw-U5NaiyKAvM5J_QXQ6-RsnXamdgnK78gXca7_RHnww%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages