On Wednesday, May 02, 2012 07:17:20 Maxim Fomin wrote: > On Wednesday, 2 May 2012 at 03:38:41 UTC, Adam D. Ruppe wrote: > > On Wednesday, 2 May 2012 at 03:22:02 UTC, Andrei Alexandrescu > > > > wrote: > >> One feature to remove stands out - the struct initialization: > >> S s = { 1, 2 }; > > > > I could live without that one, because D has an alternative: > > > > auto s = S(1, 2); > > It has the same problem as the first one: members are part of the > interface and a new one: struct literals are impossible if opCall > is defined (if I am not mistaken).
Yes, members are part of the interface, but if {1, 2} isn't legal, then their order isn't part of the interface as far as constructing the object is concerned (the memory layout is, so low-level stuff could still be broken by swapping or adding member variables, but the construction doesn't have to stop working like it does with a C struct literal). And defining opCall shouldn't have any effect on S(1, 2). S(1, 2) is clearly calling the constructor. The only reason that you would have a conflict is if you also defined a static opCall which conflicted. If a non-static opCall has _any_ effect on S(1, 2), then it's a bug. - Jonathan M Davis