I'm working on typescript type engine for the swc project. I faced a hard problem that is specific to rust.
Problematic code is
I need to change the order of evaluation. However, the definition of class C4 requires a definition of C5 and C6, while each definition of C5 and C6 requires a definition of C4. It's the same for C5 and C6.
Also, I need to preserve the evaluation context (e.g. In a method named
foo declared in a class named
Bar) due to type parameters.
I said rust-specific because if I was using other languages, closure can be the solution I think, but in rust, two closure which mutates the same variable cannot exist.
How can I implement this?