Thread overview |
---|
May 03, 2004 [bug] static constructor not invoked for 'inner' class | ||||
---|---|---|---|---|
| ||||
D doesn't have inner classes per se, but you can happily declare a class within a method/function/class, which is great. However, if you declare one of these 'inner' classes with a static constructor, said constructor never gets invoked. I don't have the example any more, but it was along these lines: void testSomething() { class Inner { static this() { // never called } this() { // called correctly } } Inner inner = new Inner(); } Moving the Inner class to module scope resolves the issue, but that's not the point ... - Kris |
June 02, 2004 Re: [bug] static constructor not invoked for 'inner' class | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kris | Here's an example of the bug: void main() { class S { static this() { printf ("static constructor\n"); } this() { printf ("class constructor\n"); } } new S; } - Kris "Kris" <someidiot@earthlink.dot.dot.dot.net> wrote in message news:c74fis$gfi$1@digitaldaemon.com... > D doesn't have inner classes per se, but you can happily declare a class within a method/function/class, which is great. However, if you declare one > of these 'inner' classes with a static constructor, said constructor never gets invoked. > > I don't have the example any more, but it was along these lines: > > void testSomething() > { > class Inner > { > static this() > { > // never called > } > > this() > { > // called correctly > } > } > > Inner inner = new Inner(); > } > > > Moving the Inner class to module scope resolves the issue, but that's not the point ... > > - Kris > > |
Copyright © 1999-2021 by the D Language Foundation