D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 20173 - StructMemberInitializer syntax on right side of assigning
Summary: StructMemberInitializer syntax on right side of assigning
Status: RESOLVED DUPLICATE of issue 15692
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P1 enhancement
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-08-27 13:35 UTC by a11e99z
Modified: 2022-07-05 17:37 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description a11e99z 2019-08-27 13:35:26 UTC
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 ZombineDev 2022-07-05 17:37:11 UTC

*** This issue has been marked as a duplicate of issue 15692 ***