Hacker News new | ask | show | jobs
by thejameskyle 3479 days ago
> Creating a static attribute on a class and initializing it right there, as in: class A { static b:B = new B(); }

That is how the ECMAScript spec is designed. And TypeScript _should_ follow the spec.

1 comments

Yes, it needs to be created 'right there' - but not in the context of other modules loads.

I doubt that a strict interpretation requires that it does so before other modules are loaded.

I suggest that 'right there' , i.e. the execution context can be delayed until mods are loaded.

One could argue that all modules could be loaded before execution context.

In Java, for example, you do not have this problem and yet, in Java we would say the attribute is initialized 'right there' as well.

Obviously, when I say 'loaded' I don't mean 'executed'.

In any event, it's a problem.