[PATCH] D34600: [Error] add expectSuccess()

Lang Hames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 29 17:29:44 PDT 2017


lhames added a comment.

> FWIW, I'm happy w/ all of the alternatives (and names) listed by Zach.

Ditto. I'm happy for this to be renamed to something more obvious. Ideally not too wordy though - there are some situations where this API might be used a bit. (E.g.: I'm about to errorize the ORC APIs, so clients building local JITs will have to wrap calls with cantFail).

> I wonder if there is a better name for Expected<T> to give a hint that it consumes the expected and produces the T? Maybe assertAndGet? assertOrGet?

FWIW I found that in practice it obvious from context that cantFail would return the wrapped result:

  auto X = cantFail(foo(...));

Once people know to look for an 'assertSuccess' type function, the lack of an 'AndGet' suffix seems unlikely to confuse them.


https://reviews.llvm.org/D34600





More information about the llvm-commits mailing list