struct init() method
Dmitry Olshansky
dmitry.olsh at gmail.com
Sat Feb 25 13:04:38 PST 2012
On 25.02.2012 8:05, bearophile wrote:
> This program comes from a reduction of a bug I've found:
>
>
> struct Foo {
> void init() {}
> }
> void main() {
> Foo*[] foos;
> //(*foos[0]).init(); // OK
> foos[0].init(); // Error: function expected before (), not null of type Foo*
> }
>
>
> What do you think about the idea of not allowing methods named init() in structs? (Especially if they are a @property). Or maybe there is a better solution, opinions welcome.
>
> Bye,
> bearophile
FWIW I've encountered this thingy while messing with phobos std.file
around a year ago. Still allowed and mishandled it seems.
--
Dmitry Olshansky
More information about the Digitalmars-d-learn
mailing list