[Lldb-commits] [lldb] [lldb] Turn lldb_private::Status into a value type. (PR #106163)

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Wed Aug 28 02:45:51 PDT 2024


labath wrote:

> > * since this seems like a perfect opportunity to bikesh^Wdiscuss the names, I'm going to ask if there's any appetite for shortening some of the new factory functions. `Status::FromErrorStringWithFormatv` is a bit of a mouthful, so I was thinking if we could  use something shorter instead (`Status::FromFormatv` or even `Status::Formatv`) ?
> 
> I picked these names, because they are in line with the old names, which made the regex replacement feasible. Renaming them afterwards is going to be easier. My 2 cents on the naming: I had `Status::FromFormatv` in a previous iteration of this patch and changed my mind, because it doesn't indicate that this is going to be an error. What do you think about the slightly shorter `Status::ErrorFromFromatv()`?

I think it's better (because its shorter), though it's still a bit long for my taste. FWIW, I don't find the short name at all confusing, because my mental model of these error types is (and all types I know behave that way) is that they have only one "success" value, and everything else represents some kind of an error/failure. So, when I see anything more complicated than `Status()` (or whatever the final API is for constructing success values), I immediately expect an error status.

I guess one difference is that I'm used to working with `absl::Status` (which I believe was zturner's inspiration for this name), so "status" feels just like a synonym for "error" to me. If you think having the word "error" in the name helps, I'd also be fine with `Status::Errorf` and `Status::Errorv` (for printf vs formatv styles) or something like that.

https://github.com/llvm/llvm-project/pull/106163


More information about the lldb-commits mailing list