Designated initializers to function argument

bachmeier no at spam.net
Fri Jul 28 17:04:33 UTC 2023


On Friday, 28 July 2023 at 07:35:00 UTC, IchorDev wrote:
> On Tuesday, 11 July 2023 at 17:43:43 UTC, Steven Schveighoffer 
> wrote:
>> On 7/11/23 11:22 AM, Ki Rill wrote:
>>> On Tuesday, 11 July 2023 at 15:16:54 UTC, Ki Rill wrote:
>>>> apply(Appearance(color: BLACK, strokeWidth: 4)); // other 
>>>> fields are default initialized: strokeOpacity, fillOpacity,
>>
>> Yes, I was going to reply that v 2.103 has added (stealthily) 
>> named parameters *as a partial implementation*. Included in 
>> this is struct initializers, and constructors and functions 
>> that are *not* templates.
>>
>> If you are willing to use DMD 2.103 and above, you should be 
>> good.
>>
>> -Steve
>
> N-no way?! The spec makes no mention of them, is it really safe 
> to use them yet?

[The 
DIP](https://github.com/dlang/DIPs/blob/master/DIPs/accepted/DIP1030.md) was approved long ago. It was waiting for an implementation.


More information about the Digitalmars-d-learn mailing list