I think it’s fine to bear with order dependency problem of initialization.
What I am concerned with now is
log crate, which is in nursery right now, uses different queue from the
std. This makes the order problem more complicated. Not only you need to worry about the relative position in each queue, now you also have to be careful about the relative positions of queues.
For this specific case,
libc::atexit seems to be invoked later than the
sys_common::at_exit. This means the
logger is destructed later than
stdout. Although both
stdout are legitimate
stdout seems to be lower level than
It should be easy to implement tactic solution for the problem at hand, but I would like to try do the thing in the right way. I think it would be nice to
- Implement a recommended-to-use method to destruct
static variable. This can be either kind of queue, but we need a way for user to reasonable the exact sequence of restructuring.
- Consider establishing an order of
static, and put them in the lowest level so that they have long enough time to live to wait for other
statics to destruct.
In the current case maybe to expose some form of
lazy, and use them consistently both in and out of