[libcxx-commits] [PATCH] D108144: [libc++] Introduce _LIBCPP_EXPRESSION_EQUIVALENT

Arthur O'Dwyer via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Aug 16 15:56:11 PDT 2021


Quuxplusone added a comment.

> So I wonder why is the name changed from `_LIBCPP_INVOKE_RETURN` to `_LIBCPP_EXPRESSION_EQUIVALENT`?

The macro in `<type_traits>` was originally named `_LIBCPP_INVOKE_RETURN` because it was an implementation detail of `std::invoke`. But if we generalize it beyond `invoke`, it makes sense to name it after what it does, which is indeed to make something "expression-equivalent" in the Standard's sense (in terms of noexceptness and SFINAE-friendliness as well as the value it yields). So I think `_LIBCPP_EXPRESSION_EQUIVALENT` would be a fine name for it. My personal suggestion — "cute" but not at all sarcastic — is `_LIBCPP_THREE_TIMES`, after Vittorio Romeo's lightning talk. (It's shorter; it depicts even more explicitly what's hidden behind the macro façade; for better and worse, it eliminates the standardese jargon.)

Personally my preferences would be (from "best" to "worst":

- Standardize on the tedious non-macro version, eliminating `_LIBCPP_INVOKE_RETURN`. Normalize everyone's whitespace to match what's in `bind_back.h`.
- Standardize on `_LIBCPP_EXPRESSION_EQUIVALENT` or whatever its bikeshedded name ends up being, eliminating `_LIBCPP_INVOKE_RETURN`.
- Just leave the status quo.

Even the "worst" of these is not bad at all.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108144/new/

https://reviews.llvm.org/D108144



More information about the libcxx-commits mailing list