[Patch] ErrorOr is not a pointer, don't use a pointer API.

Rafael EspĂ­ndola rafael.espindola at gmail.com
Wed Jan 8 11:57:37 PST 2014


On 8 January 2014 14:45, dblaikie at gmail.com <dblaikie at gmail.com> wrote:
> FWIW there are other non-pointers that use pointer-like semantics, such as
> boost::optional. So there's precedence in some pretty mainstream APIs for
> this design.

Thanks for the pointer. I still find using * and -> confusing in
something that behaves like a value. If we do decide to keep them,
would you guys be ok with

* Still adding the explicit get and getError methods (boost::optional
has a get).
* Removing the error_code conversion operator. IMHO foo.getError() is
always nicer than error_code(foo).

> But I don't work with code using this type very much, so it's best left up
> to you/them to decide what kind of API they're most comfortable with.
>
> Perhaps a thread link for the "as was observed before" reference would also
> be useful.

Good point. It was
http://lists.cs.uiuc.edu/pipermail/llvmdev/2013-November/068094.html.

Cheers,
Rafael



More information about the llvm-commits mailing list