Error about @disabled constructor when there is a custom one
Jonathan M Davis
jmdavisProg at gmx.com
Tue Jan 22 13:28:15 PST 2013
On Wednesday, January 23, 2013 01:12:45 Dmitry Olshansky wrote:
> 23-Jan-2013 00:28, Minas Mina пишет:
> > From Jonathan M Davis:
> > "...At this point, I don't think that the situation with default
> > constructors and
> > structs is going to change. It's a result of requiring init properties
> > for all
> > types, and is thus a "forced fault" in the language..."
> >
> > Why does requiring init properties for all types results in this? What
> > does that even mean?
>
> I don't buy it either. 0-argument constructor have nothing to do with
> requiring .init.
init prevents us from having _default_ constructors. As much as no-arg
constructors are normally default constructors, they're technically separate
concepts. static opCall shows us that it's perfectly possible to have no-arg
constructors.
However, there's a certain danger in simply making a no-arg constructor for
structs not be a default constructor, as pretty much anyone coming from
another OO language will expect it to be a default constructor. For the most
part, static opCall solves the problem.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list