C++ Logo

STD-PROPOSALS

Advanced search

Subject: Re: [std-proposals] Operator functions to fix ADL
From: Григорий Шуренков (grigorij1981_at_[hidden])
Date: 2020-10-11 11:49:53


I am not against a contextual keyword. I am reusing an existing keyword,
because ADL was invented mainly for operators, so to me it's a natural
thing to call ADL-enabled functions "operators". But if someone comes up
with a better (contextual) keyword I am all for it.

To avoid parsing problems we can indeed place *operator *(or other
ADL-marker) after the declarator:
void swap (A&, A&) noexcept operator;

On Sun, Oct 11, 2020 at 11:36 AM Arthur O'Dwyer <arthur.j.odwyer_at_[hidden]>
wrote:

> However, that might be hard because of how ADL works. The biggest
> practical problem with ADL is not that it sometimes *finds *unexpected
> best-matches (although that is a minor problem). The biggest problem is
> that it *looks *for them in the first place. The *lookup *is the thing
> that can trigger hard un-SFINAE-able errors.
>
The proposal is a first step, after deprecating ADL for most of the
unqualified function calls and waiting 2-3 releases, we can change rules
when to trigger ADL. I am not sure whether anything can be done for
operators themselves though. You'd still want at least a limited version of
ADL for them, and having yet another form of ADL would complicate things
even further.

On Sun, Oct 11, 2020 at 11:36 AM Arthur O'Dwyer <arthur.j.odwyer_at_[hidden]>
wrote:

> FYI, (1) seems like a non-starter unless you can solve the parsing
problem. `operator swap();` is already valid C++ syntax.
(With some fun implementation divergence there! https://godbolt.org/z/GKb756
 )

Pity, I liked the syntax.

Regards,
Gregory

>



STD-PROPOSALS list run by std-proposals-owner@lists.isocpp.org

Standard Proposals Archives on Google Groups