In-place struct initialization
Paul Backus
snarwin at gmail.com
Tue May 3 13:47:54 UTC 2022
On Tuesday, 3 May 2022 at 09:56:36 UTC, test123 wrote:
> consider this code:
>
> ```d
> struct Test {
> string tag;
> string logger;
> bool profile;
> int verbose;
> }
>
>
> @Test({verbose:true)
> void doTest(){
>
> }
>
> ```
>
>
> With in-place struct initialization you need pass all arguments.
This will be covered by DIP 1030, "Named Arguments":
https://github.com/dlang/DIPs/blob/master/DIPs/accepted/DIP1030.md
The DIP has already been accepted, and work is currently
in-progress to implement it in the compiler. Once it is finished,
you will be able to write code like the following:
```d
@Test(verbose: true)
void doTest() {
// ...
}
```
More information about the Digitalmars-d
mailing list