-preview=in might break code
Paul Backus
snarwin at gmail.com
Sat Oct 3 18:36:10 UTC 2020
On Saturday, 3 October 2020 at 16:56:06 UTC, Mathias LANG wrote:
>
> To put it differently: Why is `auto ref` acceptable but `in` is
> not ?
The issue with `in`, compared to `auto ref`, is that, because its
behavior is implementation-defined, it invites programmers to
write code that "works on their machine," but is not portable to
other environments (including future versions of the same
compiler). It's the same issue that C has with features like
variable-sized integer types and implementation-defined
signedness of `char`.
Yes, *technically* it's your fault if you write C code that
relies on an `int` being 32 bits, or a `char` being unsigned,
just like it would *technically* be your fault if you wrote D
code that relied in an `in` parameter being passed by reference.
But making these things implementation-defined in the first place
is setting the programmer up for failure.
More information about the Digitalmars-d
mailing list