In other words, the proposal is more-or-less that C++ should introduce a new token, ::< , which is treated by the parser as "The same token as < but it's invariably an angle bracket, not a less-than sign." Phrased that way, the proposal is simple, but that doesn't make it good.

I would like to see some kind of cleanup around angle-brackets, but this particular small fix doesn't provide enough benefit to justify its cost.
The cost of changing the parser is honestly not very big (we did it for operator<=>). But our changes should find ways to improve the code people already write, like
    template<enable_if_t<X,int>=0> // syntax error because ">=" is a token
The proposed change merely takes code that people already avoid (because it is ugly) and introduces a special-case ad-hoc hack to make it still ugly but 7 characters shorter. Which nobody will use, because in order to use it you have to know that the problem exists, and once you know the problem exists, the problem is already solved. The problems we should focus on solving are the problems that people tend to run into without understanding them.

I don't like "Down with typename!" either, but at least it was focused on making the compiler accept the code that people already write. This proposal just makes up a new syntax that people won't want to write (even if they knew they could, which they won't).

Lastly, isn't `x.get<0>()` already fixed by http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p1787r6.html "Declarations and where to find them"?
I'm even more confident that it fixes
    using f = T::type<0>;
because that is a typeid-only context, where the `<` cannot possibly denote a less-than sign.

my $.02,
–Arthur


On Fri, Oct 8, 2021 at 4:21 PM Jean-Baptiste Vallon Hoarau via Std-Proposals <std-proposals@lists.isocpp.org> wrote:
Hi, 

"x.template get<0>()" becomes "x.get::<0>()". 

(That's addressed in the first email, but perhaps the formatting makes that unclear)

Le ven. 8 oct. 2021 à 22:15, Barry Revzin <barry.revzin@gmail.com> a écrit :


On Fri, Oct 8, 2021 at 2:11 PM Jean-Baptiste Vallon Hoarau via Std-Proposals <std-proposals@lists.isocpp.org> wrote:
The current disambiguator for template members of context dependent ID is excessively verbose, to the point where members functions template needing explicit parameters are largely avoided. This is a problem. 

I think that the Rust "turbofish" syntax provides an elegant alternative, which consists of having the token "::" preceding the template parameters list.
That is the code 

```
x.template get<0>();
using f = T::template type<0>;
```

becomes :

```
x.get::<0>();
using f = T::type::<0>;
//                       ^^
```

I hope that you'll agree that this syntax is more ergonomic. It's also not unpleasant from a semantic point of view, as "::" is used to query a child entity, and template instantiation are childs entities of the primary template. 

It would also not be difficult to allow the turbofish in front of every templates parameter list, for consistency. E;g. : 

```
template <int N> struct type{};
type::<0> x; // not needed, but ok
```

Would this create any conflicts with the current C++ grammar ?

What would you do for member function calls? For instance, today's "x.template get<0>()" becomes... ?

Barry
--
Std-Proposals mailing list
Std-Proposals@lists.isocpp.org
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals