On Monday, 11 September 2023 at 19:59:37 UTC, ryuukk_ wrote:


I would love to be able to use C style designated initialization everywhere too..

Recent version of D added named arguments so you can do something like:

```D
void someFunction(Options option = Options(silenceErrors: false))
```

I don't like the useless repeating "option option option", but that's D for you


```d
void someFunction(bool silenceErrors = false, bool otherOption = true)

someFunction(otherOption: false); // works
```

I know options structs have benefits besides allowing parameter specification, but with the latest allowance of named parameters, it's worth exploring whether you still want to use an options struct or not.

-Steve

Reply via email to