C++Now 2018 has ended
Back To Schedule
Wednesday, May 9 • 4:30pm - 6:00pm
Option(al) Is Not a Failure

Log in to save this to your schedule, view media, leave feedback and see who's attending!

Feedback form is now closed.
Error code returns were bad so we invented exceptions. Much better we said.
Then we realised exceptions had their problems - with whole domains outlawing their use altogether. We've been trying to patch them up how we can (with noexcept, for example) - but most of the problems are systemic.

So there's a return to error codes. But now we have new features in the language (arithmetic data types, including variant and optional) - and the promise of more coming (expected, outcome?) - that bring us closer to the best of both worlds, with almost none of the downsides. While the vocabulary types are important, we don't need to wait for them - and the more experience we gain with these approaches the better - especially as std::expected gets locked down, Boost.Outcome goes through final reviews.

But there's more. Where do error_code and error_condition fit in? What's all this about monadic binding? What about pattern matching? Do/ try syntax with a keyword? What do other languages that are further down this road do and what can we learn from them?

This talk will be a tour of the past, present, and possible future of C++ error handling, the trade-offs and rationale for each piece and a discussion of where to go next and what we can do as a community to get there.

Note that, while technical, this is Big Picture - with lots of jumping off points for other talks and materials that are deep dives on individual components and techniques.

avatar for Phil Nash

Phil Nash

Developer Advocate, JetBrains
Phil is the author of the test frameworks, Catch - for C++ and Objective-C, and Swordfish for Swift. As Developer Advocate at JetBrains he's involved with CLion, AppCode and ReSharper C++. More generally he's an advocate for good testing practices, TDD and using the type system and... Read More →

Wednesday May 9, 2018 4:30pm - 6:00pm MDT