OT: Leaving Rust gamedev after 3 years
bachmeier
no at spam.net
Mon Apr 29 18:53:24 UTC 2024
On Monday, 29 April 2024 at 17:52:12 UTC, monkyyy wrote:
> On Monday, 29 April 2024 at 14:58:00 UTC, bachmeier wrote:
>> Setting x to 0 is no better for correctness than setting it to
>> a random number. Either way, you're pretending the compiler
>> knows what it should be, and that's impossible.
>
>> *no better*
>
> trade offs and downsides do not imply relativism
>
> "different countrys use different drinking ages, lol laws have
> no right answers, better legalize cannibalism"
This misses the point. You don't use drinking ages to determine
the "correct" age at which drinking should be allowed to start. A
computer program should produce the correct answer every time it
runs. Having variables initialized to a particular value is
better than nothing, but better than that is if `double x;` fails
to compile and you explicitly set it to what you need.
> 0 is correct for sum, 1 is correct for products, random numbers
> are even ok; yes so there tradeoffs between any of these; but
> nan is a black hole specifically designed to break everything
It's no more of a black hole than 0 or 1. It can be used to
represent missing data, which is just as valid as 0 or 1. Does
that mean it's a good choice for initialization of a double? I
don't think so, but that does not justify using 0.
More information about the Digitalmars-d
mailing list