Feedback Thread: DIP 1034--Add a Bottom Type (reboot)--Community Review Round 1
Steven Schveighoffer
schveiguy at gmail.com
Thu May 7 00:20:44 UTC 2020
Great DIP!
In the breaking changes, it says "Any code assuming `is(typeof([]) ==
void[])` will break."
However, this is not exactly correct. If code *assumes* it is typed as
void[], it will probably work.
For example:
void foo(void[])
{
}
foo([]); // I'm assuming it's void[], but it will still work.
The point being made is that the result of the expression `typeof([])`
is changing. And any code that depends on that specific relationship for
declarations will break.
I would change it to "Any code using the expression `typeof([])` for
declarations or for template parameters might break. Any code that
infers the type of a variable using the expression `[]` will also likely
break."
I agree with the rest, because why would you write typeof([]) instead of
void[]?
One possible exception:
auto x = []; // instead of typing void[] x, saving 2 characters!
x ~= ...; // now an error.
Another thing that would break -- if for some reason you have a type
named "noreturn", and you import that from another module, there will be
an ambiguity between object.noreturn and somemodule.noreturn.
I bet the chances of this are almost nil, but it is a possible breakage.
-Steve
More information about the Digitalmars-d
mailing list