Why does opCall disable struct-literal syntax?

Adam D. Ruppe via Digitalmars-d digitalmars-d at puremagic.com
Sun Nov 8 15:54:51 PST 2015


On Sunday, 8 November 2015 at 23:26:44 UTC, rcorre wrote:
> Is this just a technical limitation, or is there some other 
> reasoning?

Old bug/misdesign inherited from old D before there were struct 
constructors. It really should be the rest of the way fixed, but 
non-static and static methods, including opCall, are still not 
properly distinguished by the D language.

Type.staticFunction(); // compiles, used to be done to kinda 
mimic constructors before they were there

obj.staticFunction(); // also compiles, which means a change at 
this point would be a breaking change



More information about the Digitalmars-d mailing list