[PATCH] D108696: [Coroutines] [Frontend] Lookup in std namespace first

Chuanqi Xu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 29 09:01:51 PDT 2021


ChuanqiXu added a comment.

In D108696#3096822 <https://reviews.llvm.org/D108696#3096822>, @Quuxplusone wrote:

> In D108696#3095789 <https://reviews.llvm.org/D108696#3095789>, @ChuanqiXu wrote:
>
>> Since there are other `experimental/*` headers moved in to normal include paths, I guess there may be similar problems before. I think this problem is not limited in coroutine. So how does libc++ do before for this situation @Quuxplusone ?
>
> I'm not aware of any similar situations involving `<experimental/*>`. Most stuff in `<experimental/*>` is just library stuff, like `std::experimental::pmr`, where the two versions can happily coexist because we have namespaces. Coroutines are special (and really annoying) because they're a core-language feature with a "magic" relationship to a specific library header. (Core-language syntax doesn't respect namespaces.) The only other "magic" features like that are
>
> - `typeid` looks for `std::type_info`
> - `{}` looks for `std::initializer_list`
> - `auto [a,b]` looks for `std::tuple_size` etc.
> - `<=>` looks for `std::strong_ordering` etc.
>
> None of these were ever prototyped in `<experimental/*>` before being put into the Standard, so they never ran into this problem.

Oh, got it. So now is the time to do policy decision and the community didn't meet similar problem before. Here is my reason for not supporting both:

- It is complex to implement.
- It would be removed in recent future. Complexity is not a very strong reason to refuse a need. But it is frustrating to implement a feature which would be removed in a predictable recent future.
- From the perspective of users, it shouldn't be hard to switch from std::experimental::coro* to std::coro*. I write coroutine codes in production too. AFAIK, it should be easy. (I understand that I couldn't stand for all the users)

Here are my reasons. But if we couldn't get in consensus. I guess we could only post this to cfe-dev to ask more people for involving in.


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

https://reviews.llvm.org/D108696



More information about the cfe-commits mailing list