Bug 20173 – StructMemberInitializer syntax on right side of assigning
Status
RESOLVED
Resolution
DUPLICATE
Severity
enhancement
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2019-08-27T13:35:26Z
Last change time
2022-07-05T17:37:11Z
Assigned to
No Owner
Creator
a11e99z
Comments
Comment #0 by black80 — 2019-08-27T13:35:26Z
https://dlang.org/spec/struct.html#static_struct_init
u can create struct instance like:
S s = { a:1, b:2 };
but u cannot assign/reset existing instance with same syntax:
// s defined above already
s = S { a:2, b:3 }; // MANY ERRORs
for me its looks same.
my version is even better for initialization too
auto s = S { a:2, b:3 };
// var = type with some fields
cuz current style is a little bit weird, out of D style, that used only for struct initialization:
concreteType var = { fields };
why assign= here is mandatory?
do will change arcane meaning without it? probably not at all
yes, struct literals + named args will solve issue
but I want subj for uniformity.
Comment #1 by petar.p.kirov — 2022-07-05T17:37:11Z
*** This issue has been marked as a duplicate of issue 15692 ***