Re:C++ vs. OCaml: Ray tracer comparison (2005)
by lholden on Wednesday September 23, 2015 @04:29PM
(#10267935)
Already done (kinda). There is no match exhaustion, but C++ is getting an option type. (Part of the library fundamentals TS). http://en.cppreference.com/w/cpp/experimental/optional
Re:C++ vs. OCaml: Ray tracer comparison (2005)
by loop2 on Wednesday September 23, 2015 @04:25PM
(#10267900)
Option has been around for a while as boost::optional or now std::experimental::optional. Result is coming and has a reference implementation as boost::expected. There's also a type-erased option type, "any".
They're quite nice, especially with a few trivial additions for ergonomics.
Would be nice to see Rust's Option<T> and Result<T,E> ported over to C++ since I find that error handling extremely elegant compared to most C++ approaches.