using .init reliably

Jonathan M Davis via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Aug 26 05:42:28 PDT 2016


On Friday, August 26, 2016 10:52:47 Cauterite via Digitalmars-d-learn wrote:
> On Friday, 26 August 2016 at 09:48:00 UTC, Jonathan M Davis wrote:
> > And I expect that it will become an error at some point in the
> > future to define an init member for a user-defined type, at
> > which point, there won't be any choice about fixing it.
>
> I might take a crack at this patch. Sounds pretty trivial.

The key thing to keep in mind is that it needs to be deprecated first rather
than just simply made an error (in order to avoid breaking existing code
without warning), which may or may not make it more complicated. I'm not
familiar with much of the compiler's internals. Regardless, it would be
great if we could move towards making it illegal to define init for a type,
since it's a definitely problem that it's been possible.

- Jonathan M Davis



More information about the Digitalmars-d-learn mailing list