Allow struct constructors with all parameters optional

ryuukk_ ryuukk.dev at gmail.com
Fri Aug 30 05:38:25 UTC 2024


On Thursday, 29 August 2024 at 20:29:22 UTC, IchorDev wrote:
> On Thursday, 29 August 2024 at 13:57:05 UTC, ryuukk_ wrote:
>> Are you seriously telling people to write a library to be able 
>> to do what C already provides for decades?
>
> Since when did C99 have struct constructors? You can have a 
> factory function in both languages, and they are the preferred 
> method for ‘default construction’. However, in C you can’t 
> `@disable this()`, so you have to trust the user to get it 
> right by calling your factory function instead of just creating 
> an uninitialised struct variable.

i didn't say a constructor, this whole thread is the result of D 
not having the foundation right


Allow this:

```D

my_fun( Data { c: 1 } );

```

And you don't need all of that extra shit


> However, in C you can’t `@disable this()`, so you have to trust 
> the user to get it right by calling your factory function 
> instead of just creating an uninitialised struct variable.


lol, no, reject bloat, and stick to simplicity






More information about the dip.ideas mailing list