struct init() method
Jonathan M Davis
jmdavisProg at gmx.com
Sat Feb 25 17:54:59 PST 2012
On Saturday, February 25, 2012 17:54:44 H. S. Teoh wrote:
> On Sun, Feb 26, 2012 at 12:23:47AM +0100, Alex Rønne Petersen wrote:
> > On 26-02-2012 00:18, Jonathan M Davis wrote:
> > >On Saturday, February 25, 2012 17:07:14 Timon Gehr wrote:
> > >>This is useful:
> > >>
> > >>struct S{
> > >>
> > >> @disable enum init = 0;
> > >>
> > >>}
> > >
> > >I thought that the way that you were supposed to do that was
> > >
> > >@disable this();
> > >
> > >- Jonathan M Davis
> >
> > Yeah, I'm not sure what purpose the other example serves.
>
> [...]
>
> It serves to prove that we need to disallow 'init' as a member name. :-)
No. I think that he meant that he doesn't know what purpose
@disable enum init = 0;
serves given that
@disable this();
already disables the init property. The fact that you're able to override init
is a separate, albeit related issue. But yes, it should be disallowed to
declare any symbol as a member of a struct or class with the name init.
- Jonathan M Davis
More information about the Digitalmars-d-learn
mailing list