News for hackers. Stuff that matters.
Re:A bug in GCC that may cause memory leaks in valid C++ pro... by codedokode on Friday April 28, 2017 @02:14AM (#14217206)
I disagree. You are suggesting everyone should write error handling code manually rather than rely on compiler.
Re:A bug in GCC that may cause memory leaks in valid C++ pro... by vertex-four on Friday April 28, 2017 @05:10AM (#14217958)
Not really. See Rust/Scala/Haskell's Result/Either type, which has compiler support, but that compiler support is lightweight - you use the same control structures and flows as with regular code.
Re:A bug in GCC that may cause memory leaks in valid C++ pro... by lmm on Friday April 28, 2017 @07:50AM (#14218643)
That's a great approach, but needs sum types and HKT to be effective, neither of which C++ really has (std::variant exists but doesn't always behave as a proper sum type AIUI) at present.
Re:A bug in GCC that may cause memory leaks in valid C++ pro... by vertex-four on Friday April 28, 2017 @09:17AM (#14219093)
Rust manages it without HKT quite reasonably (rather than implementing generic monads, it has the `?` operator, which is syntax-sugar for something like [0]), though sum types are a necessity.

[0] match whatever { Ok(v) => v, Err(e) => return Err(From::from(e)) }

Re:A bug in GCC that may cause memory leaks in valid C++ pro... by lmm on Friday April 28, 2017 @09:38AM (#14219233)
Ah, last I knew they were relying on macros. Still, ? is an ugly special case where with HKT it could be a reusable general operator.
Re:A bug in GCC that may cause memory leaks in valid C++ pro... by vertex-four on Friday April 28, 2017 @10:00AM (#14219405)
Absolutely - there's currently discussion around a Carrier trait which would make it generic, once we have some variety of HKT. Still, it's good enough for now, and any future development of it will be backwards-compatible.