Re: Static Initialization of Structs syntax

2022-06-22 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 22 June 2022 at 11:19:59 UTC, Antonio wrote: I see now: DIP 1033 will solve this (i.e., using named arguments in struct constructor... similar to how dart/flutter works) That would be DIP 1030: https://github.com/dlang/DIPs/blob/master/DIPs/accepted/DIP1030.md Max Haughton

Re: Static Initialization of Structs syntax

2022-06-22 Thread Antonio via Digitalmars-d-learn
On Wednesday, 22 June 2022 at 09:41:55 UTC, Antonio wrote: I'm so sorry, I know that the above example doesn't work: ```d main(){ Struct PersonDTO { string name; string surname; } void create(PersonDTO personData){ // ... } create( {name: "Peter", surname: "Ustinov"} ); }

Static Initialization of Structs syntax

2022-06-22 Thread Antonio via Digitalmars-d-learn
I'm so sorry, I know that the above example doesn't work: ```d main(){ Struct PersonDTO { string name; string surname; } void create(PersonDTO personData){ // ... } create( {name: "Peter", surname: "Ustinov"} ); } ``` -Is it there any alternative to initialize "inline" d

Re: static initialization of structs

2012-12-01 Thread Dan
On Sunday, 2 December 2012 at 01:50:08 UTC, Jonathan M Davis wrote: On Saturday, December 01, 2012 19:36:34 Dan wrote: That syntax is from C. There was definitely a push to deprecate it, and personally I definitely think that it should go, but I don't recall that it was definitively decided t

Re: static initialization of structs

2012-12-01 Thread Jonathan M Davis
On Saturday, December 01, 2012 19:36:34 Dan wrote: > In the thread on compiling DSSS and build tools someone mentioned > a format for initializing environment data of a struct: > >Environment env = { > tests: true, > verbose: true, > importDirs: ["../deimos"] >} >

Re: static initialization of structs

2012-12-01 Thread Rob T
On Saturday, 1 December 2012 at 18:36:35 UTC, Dan wrote: In the thread on compiling DSSS and build tools someone mentioned a format for initializing environment data of a struct: Environment env = { tests: true, verbose: true, importDirs: ["../deimos"] } A followup co

static initialization of structs

2012-12-01 Thread Dan
In the thread on compiling DSSS and build tools someone mentioned a format for initializing environment data of a struct: Environment env = { tests: true, verbose: true, importDirs: ["../deimos"] } A followup comment says "isn't that syntax intended to be deprecated?"