float init 0 request

Juraj junk at vec4.xyz
Mon Aug 17 09:17:02 UTC 2026


On Monday, 17 August 2026 at 07:52:21 UTC, Serg Gini wrote:
> On Sunday, 16 August 2026 at 02:00:29 UTC, Walter Bright wrote:
>> BTW, C and C++ will default initialize all variables to 
>> garbage when they are declared as a function local! Those are 
>> very hard to track down. I once spent 3 days trying to track 
>> one down. It scarred me for life.
>
> I think we should stop comparing with 50 years old languages. 
> The bar is too low.
>
> I've checked what modern system languages are doing:
> Mojo, Swift, Zig and Rust are not allowing to declare 
> uninitialized float.
>
> Go is making it 0.0

The main issue is `float.init`.
Once you disallow implicit initialization, you need a way to 
express explicit initialization in templates.
Any non trivial template will end up with something like
`T tmp = T.init;`
And if T is float, you are at square one, you get a silent NaN.

Dlang shines when it takes proven things and makes them ergonomic 
(templates), when it tackle a problem and make it braindead 
trivial (metaprograming).
But once it tries to "be different", even for the sake of 
correctness, it often fails.

Juraj





More information about the Digitalmars-d mailing list