Date: Tue, 22 Sep 2020 13:25:35 -0400
On Thu, Sep 17, 2020 at 9:38 PM Eric Lengyel via Std-Proposals <
std-proposals_at_[hidden]> wrote:
> http://terathon.com/disjoint_lengyel.pdf
>
I still don't understand how your new type-qualifier is supposed to help at
all.
Normally I like proposals that show exact wording — it clarifies one's
thinking — but in this case I think you have done all the wording before
you've come up with any use-cases, and I think that's a problem. I'd like
to see some use-cases and sample code.
Your very first snippet says:
int *a;
const int *p = a; // OK: const qualifier added
disjoint int *q = a; // error: disjoint qualifier cannot be added
So, if I were trying to use `disjoint` in the same way as `restrict`, and
wrote this snippet:
void foo(disjoint int *r, disjoint int *s);
int a, b;
foo(&a, &b);
you're telling me that that wouldn't compile? Because `&a` is obviously an
expression of type `(int*)` — you can't change that — and you've just told
me that `int*` is not implicitly convertible to `disjoint int*`.
So what is the intended usage of `disjoint`? What does it say about the
pointee, and how could the compiler use it to produce better codegen?
Also consider what you'd do with
disjoint int *p1 = ...;
auto p2 = p1;
static_assert(std::same_as<decltype(p1), decltype(p2)>); // ???
If p2's type is the same as p1's, then they're both `disjoint int *` — and
so you have two `disjoint int *` objects that point to the same place.
Isn't that a problem? What in your proposal deals with this kind of thing?
–Arthur
std-proposals_at_[hidden]> wrote:
> http://terathon.com/disjoint_lengyel.pdf
>
I still don't understand how your new type-qualifier is supposed to help at
all.
Normally I like proposals that show exact wording — it clarifies one's
thinking — but in this case I think you have done all the wording before
you've come up with any use-cases, and I think that's a problem. I'd like
to see some use-cases and sample code.
Your very first snippet says:
int *a;
const int *p = a; // OK: const qualifier added
disjoint int *q = a; // error: disjoint qualifier cannot be added
So, if I were trying to use `disjoint` in the same way as `restrict`, and
wrote this snippet:
void foo(disjoint int *r, disjoint int *s);
int a, b;
foo(&a, &b);
you're telling me that that wouldn't compile? Because `&a` is obviously an
expression of type `(int*)` — you can't change that — and you've just told
me that `int*` is not implicitly convertible to `disjoint int*`.
So what is the intended usage of `disjoint`? What does it say about the
pointee, and how could the compiler use it to produce better codegen?
Also consider what you'd do with
disjoint int *p1 = ...;
auto p2 = p1;
static_assert(std::same_as<decltype(p1), decltype(p2)>); // ???
If p2's type is the same as p1's, then they're both `disjoint int *` — and
so you have two `disjoint int *` objects that point to the same place.
Isn't that a problem? What in your proposal deals with this kind of thing?
–Arthur
Received on 2020-09-22 12:25:49