static opCall not working?

Dicebot via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Jul 20 02:28:52 PDT 2015


On Sunday, 19 July 2015 at 10:26:04 UTC, TC wrote:
> What is wrong here? Docs or behavior? Tested it on 
> asm.dlang.org where it fails with all compiler versions.

Docs are wrong here. `static opCall` was never intended to be 
used as constructor and I consider it a bad style in general. 
This is simply a workaround that people unhappy with lack of 
default struct constructor used but language actively resists 
such misusage (`auto s = new S(42)` won't work too btw) and it 
only causes confusion.


More information about the Digitalmars-d-learn mailing list