DIP 1031--Deprecate Brace-Style Struct Initializers--Community Review Round 1 Discussion
Petar
Petar
Mon Feb 17 08:00:43 UTC 2020
On Sunday, 16 February 2020 at 15:24:26 UTC, Mathias Lang wrote:
> [..]
>
> The only thing that ever annoyed me about struct literals is
> that they don't work everywhere.
I completely agree. I have several developers on my team with
mostly JavaScript/TypeScript background, and it would be quite
difficult to introduce D to them without the relatable (and also
people for coming from C) struct literal syntax.
These days is quite rare to find a JS/TS project that doesn't
make a heavy use of this feature:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment
https://javascript.info/destructuring-assignment
If accepting the named parameters proposal meant that we could
simply replace braces with parentheses, I'd onboard with DIP1031,
but not before.
(Of course that would involve a semantic change, as currently the
brace literal syntax works only for initializing structs without
constructors and named parameters are meant to invoke either the
user defined constructor or the default synthesized one.)
More information about the Digitalmars-d
mailing list