digitalmars.D - idea for static class construction order
- Jarrett Billingsley (20/20) Dec 29 2004 Was just thinking about it. Why not just add it into the module's stati...
- Matthew (3/24) Jan 21 2005 I kind of like this idea. Maybe the compiler could use the explicit orde...
- Jarrett Billingsley (1/1) Jan 23 2005 Wow, nice to see someone finally saw it :)
- Matthew (2/4) Jan 23 2005
- Russ Lewis (9/11) Jan 24 2005 I agree that it would be a cool feature (though maybe I'm missing some
Was just thinking about it. Why not just add it into the module's static this()? class A { public: static this() { ... } } class B { public: static this() { ... } } static this() { static B.this(); static A.this(); } Are there any parsing / lex problems with this construct? I'm just wondering, as the order of static constructors has been undefined for a while, and it'd kind of be nice to see it implemented. :)
Dec 29 2004
I kind of like this idea. Maybe the compiler could use the explicit order, if provided, otherwise it would determine as it currently does. "Jarrett Billingsley" <kb3ctd2 yahoo.com> wrote in message news:cqvr91$2a4c$1 digitaldaemon.com...Was just thinking about it. Why not just add it into the module's static this()? class A { public: static this() { ... } } class B { public: static this() { ... } } static this() { static B.this(); static A.this(); } Are there any parsing / lex problems with this construct? I'm just wondering, as the order of static constructors has been undefined for a while, and it'd kind of be nice to see it implemented. :)
Jan 21 2005
Wow, nice to see someone finally saw it :)
Jan 23 2005
I'm on a gradual trawl through all the entries since the 3rd August. ;) "Jarrett Billingsley" <kb3ctd2 yahoo.com> wrote in message news:ct21v3$2pt2$1 digitaldaemon.com...Wow, nice to see someone finally saw it :)
Jan 23 2005
Matthew wrote:I kind of like this idea. Maybe the compiler could use the explicit order, if provided, otherwise it would determine as it currently does.I agree that it would be a cool feature (though maybe I'm missing some unintended side effect). You can, of course, do it already; rather than declaring static constructors for the classes, simply define static functions which are called by the module constructor. I don't know how the ordering of module constructor and any (remaining) static class constructors interact, however. I guess it would be a good idea to explicitly state the order for all classes in a module where you care.
Jan 24 2005