digitalmars.D - idea for static class construction order
- "Jarrett Billingsley" <kb3ctd2 yahoo.com> Dec 29 2004
- "Matthew" <admin.hat stlsoft.dot.org> Jan 21 2005
- "Jarrett Billingsley" <kb3ctd2 yahoo.com> Jan 23 2005
- "Matthew" <admin.hat stlsoft.dot.org> Jan 23 2005
- Russ Lewis <spamhole-2001-07-16 deming-os.org> Jan 24 2005
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









"Matthew" <admin.hat stlsoft.dot.org> 