DMD 1.035 and 2.019 releases

Walter Bright newshound1 at digitalmars.com
Wed Sep 3 17:03:50 PDT 2008


bearophile wrote:
> Walter Bright:
>> If there's any constructor defined for S, then S(args) is a
>> constructor call. If there's any opCall defined for S, then S(args)
>> is an opCall call. Otherwise, it's a struct literal.
> 
> I haven't tried that in real code, so I can't be sure, but while it
> may work for the compiler, it sounds a bit too much complex for the
> person that later reads the code. Too many alternative possibilities
> may make the code more complex to follow.
> 
> To reduce such ambiguity (ambiguity for the person, not for the
> compiler) may be to change the syntax of struct literals...

I disagree, I think just the reverse. The S(args) syntax means that it's 
entirely up to the struct designer to say how it should work. The user 
needn't know or care, and the struct designer can change the design 
without affecting user code.



More information about the Digitalmars-d-announce mailing list