<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Fri, Jun 16, 2017 at 4:05 PM Zachary Turner via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Fri, Jun 16, 2017 at 3:41 PM Justin Bogner <<a href="mailto:mail@justinbogner.com" target="_blank">mail@justinbogner.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I'm a little late to the discussion, but I pretty strongly agree with<br>
Rui's suggestion that returning an Optional is a better interface here.<br>
I'm not really convinced that the cases where we can actually deduce a<br>
type come up often enough that there's a significant useability<br>
improvement.<br></blockquote><div><br></div></div></div><div dir="ltr"><div class="gmail_quote">I'm still not real crazy about it.  I don't like having to indent to handle the *success* case, </div></div></blockquote><div><br>Don't have to, but yeah - does add some extra variables or indirection syntax if it's done the other way. Eventually this'll get better with coroutines.<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_quote">which you would see a lot of with an Optional<T> return and which goes against our coding standard guidelines of early return.  There's also the issue of size.  For example, an Optional<uint64_t> is 16 bytes, so it has non-zero performance cost</div></div></blockquote><div><br></div><div>As do out parameters, of course - breaking aliasing assumptions/etc by leaking the address of a local out into the rest of the program.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_quote"> and questionable style benefits.</div></div></blockquote><div><br>I think the readability/self-documenting code of having single returns & avoiding out parameters where it fits, is pretty high up there.<br><br>That's my take on it, at least.<br><br>- Dave</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div></div>