On Thursday, 29 November 2012 at 21:43:30 UTC, Jonathan M Davis
wrote:
On Thursday, November 29, 2012 21:08:58 Jacob Carlborg wrote:
BTW, how does Java handle this? And C# if it has something
similar.
They just let you blow your foot off. All static variables can
be directly
initialized at runtime, so it's easy to use variables before
they're actually
initialized. I don't know how they decide what order to run
static
constructors in, but AFAIK, it never worries about circular
dependencies.
We're only running into this problem beacuse we're trying to
provide higher
safety and better guarantees with regards to when and how
variables are
initialized.
- Jonathan M Davis
Java have static block to pre initialize stuff before it is used.
But I'm not sure how they react in case of cyclic dependancies.