Movement against float.init being nan

monkyyy crazymonkyyy at gmail.com
Mon Oct 9 13:36:51 UTC 2023


On Monday, 9 October 2023 at 00:03:24 UTC, Timon Gehr wrote:
> On 8/21/22 16:09, Dark Hole wrote:
>> 
>> My point is making this by default for all primitive types. 
>> This will be consistent and simple:
>> ```d
>> bool x; // Error, use bool? or init it something meaningful
>> struct Foo { bool x; } // Error too
>> ```
>> So we have no problem "programmers make meaningless 0" and 
>> have no problem to determine init for most of types.
>
> I think a better way to approach this problem is to have a 
> language where people are not tempted to declare a variable 
> into which they have no sensible value to put in the first 
> place. If you have no value at a given point in the program, 
> you should not need a variable to hold one.

~~definitely not bumping this thread to keep it alive~~

Im pretty sure that declaration before use needs to be a thing 
cause compilers are still bad at knowing where memory sure go and 
I need my goto and global scope variables.


More information about the Digitalmars-d mailing list