C++ Logo

sg7

Advanced search

Re: Scalable reflection - questions / comments

From: Peter Dimov <pdimov_at_[hidden]>
Date: Tue, 1 Feb 2022 19:20:47 +0200
Matus Chochlik wrote:
> On Tue, Feb 1, 2022 at 6:01 PM Peter Dimov <pdimov_at_[hidden]
> <mailto:pdimov_at_[hidden]> > wrote:
>
>
> Matus Chochlik wrote:
> > template <std::meta::info mo> auto baz() {
> > return do_something([: mo :]);
> > }
> >
> > template <std::meta::info mo> auto bar(auto arg1, auto arg2) {
> > return bar<transform1<transform2<mo>(arg2)>(arg1)>();
> > }
>
> I suppose P1240 is betting that it would be possible to still do
>
> template <std::meta::info mo> auto bar(auto arg1, auto arg2) {
> return baz<transform1(transform2(mo, arg2), arg1)>();
> }
>
> with transform1 and transform2 being consteval.
>
>
>
> My concern is not that this would not be doable, more like that it's *ugly* :)

Aesthetics aside, I understand how the hypothetical consteval-only-meta
world looks in principle, but my concern is that everything needs to buy into
it for it to work well.

We have tons of already existing is_foo_v<T> / concept foo<T> primitives,
and unless we rewrite all of them as consteval is_foo(info) functions, we'll
need an instantiation context in order to use them.

So half of our functions will take the meta::info as a normal parameter, and
half as a template parameter, for no legitimate reason other than
implementation details.

Received on 2022-02-01 17:20:50