[Issue 20173] New: StructMemberInitializer syntax on right side of assigning

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Aug 27 13:35:26 UTC 2019


https://issues.dlang.org/show_bug.cgi?id=20173

          Issue ID: 20173
           Summary: StructMemberInitializer syntax on right side of
                    assigning
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: black80 at bk.ru

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.

--


More information about the Digitalmars-d-bugs mailing list