Suggestion: final struct initializers

Mr T. tee at invalid.io
Fri Dec 4 06:19:59 UTC 2020


Hello. Got a suggestion, not even a request: exhaustive struct 
initializers.

Like this:

------------------------
struct Box {
     int x;
     int y;
}

void foo() {
     Box box = {x: 3};              // ok
     Box box = final {x: 3};        // error: y not initialized
     Box box = final {x: 3, y: 7};  // ok
}
------------------------

I'd appreciate this. What do you think?


More information about the Digitalmars-d mailing list