www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20173] New: StructMemberInitializer syntax on right side of

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 puremagic.com
          Reporter: black80 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.

--
Aug 27 2019