escalier-lang / escalier

A compile-to-JavaScript language with tight TypeScript integration.
https://escalier-lang.github.io/escalier/
MIT License
21 stars 1 forks source link

Detect cycles in dependencies of decls in modules #708

Open kevinbarabash opened 11 months ago

kevinbarabash commented 11 months ago

Since decls in modules should all be pure, they can be executed in any order and depend on each other in any way as long as they don't introduce cycles, e.g.

let a = b();
let b = fn () => c + 5;
let c = 10;

is valid, but

let a = b();
let b = fn () => c + 5;
let c = a;

is not, because c -> a -> b -> c which makes the decls cyclic.