Date: Tue, 2 May 2023 12:38:11 -0400
On Tue, May 2, 2023 at 12:14 PM Andrew Tomazos via Std-Proposals
<std-proposals_at_[hidden]> wrote:
>
> Regardless of the polls, politics or history: I think the underlying design principle should be that: a type, a concept and auto should be interchangeable. All three are sets of types. A type represents the set of types of size one that includes only that type. A concept represents the set of all types that conform to the concepts requirements. auto represents the set of all types (aka the anything concept or the wildcard concept). All three should be able to appear syntactically wherever one can appear, and to mean "one of the types of this set of types". The implications of that should be secondary.
This is getting far off-topic, but practical reality means that these
implications *cannot* be secondary. Consider this code fragment:
```
void func(Name n);
using ptr = decltype(func)*;
```
Assuming that `func` is a valid declaration (based on things that came
before it), is this `using` declaration valid? Today, the answer is
"yes".
You want to create a world where the answer is "it depends on what
`Name` means".
So long as the C++ language makes a meaningful distinction between
"functions that take one type" and "functions that take a set of
types" (and it does), there will be the question of whether a function
*signature* should make it clear which kind of function we're talking
about. If there is a distinction, then it is reasonable to argue that
this distinction must be *visible* in the grammar.
That cannot be a secondary question. That's a primary question of
usability within the language. Is it OK for the way `Name` is defined
to affect the ways in which `func` can be used?
Now, maybe you want to change how these things work. Maybe you want to
be able to have pointers to template functions. Maybe you think the
language should change such that there are no distinctions between
non-template and template functions. OK, fine.
But you cannot say that this is *secondary*. Such changes are now a
pre-requisite for the kind of change in how we declare functions. The
usability question must be *addressed* one way or another, not
dismissed as "secondary".
<std-proposals_at_[hidden]> wrote:
>
> Regardless of the polls, politics or history: I think the underlying design principle should be that: a type, a concept and auto should be interchangeable. All three are sets of types. A type represents the set of types of size one that includes only that type. A concept represents the set of all types that conform to the concepts requirements. auto represents the set of all types (aka the anything concept or the wildcard concept). All three should be able to appear syntactically wherever one can appear, and to mean "one of the types of this set of types". The implications of that should be secondary.
This is getting far off-topic, but practical reality means that these
implications *cannot* be secondary. Consider this code fragment:
```
void func(Name n);
using ptr = decltype(func)*;
```
Assuming that `func` is a valid declaration (based on things that came
before it), is this `using` declaration valid? Today, the answer is
"yes".
You want to create a world where the answer is "it depends on what
`Name` means".
So long as the C++ language makes a meaningful distinction between
"functions that take one type" and "functions that take a set of
types" (and it does), there will be the question of whether a function
*signature* should make it clear which kind of function we're talking
about. If there is a distinction, then it is reasonable to argue that
this distinction must be *visible* in the grammar.
That cannot be a secondary question. That's a primary question of
usability within the language. Is it OK for the way `Name` is defined
to affect the ways in which `func` can be used?
Now, maybe you want to change how these things work. Maybe you want to
be able to have pointers to template functions. Maybe you think the
language should change such that there are no distinctions between
non-template and template functions. OK, fine.
But you cannot say that this is *secondary*. Such changes are now a
pre-requisite for the kind of change in how we declare functions. The
usability question must be *addressed* one way or another, not
dismissed as "secondary".
Received on 2023-05-02 16:38:23