Open chadaustin opened 8 years ago
Crates have nice usability characteristics: symbols defined in files are accessible by all other files in that crate. However, they really muck with the initialization order and binding sequence in each file. This is illustrated by Rust's requirement that mutating globals must be done in unsafe blocks.
Perhaps lazy initialization of globals could avoid the initialization order problem, at the cost of code size.
Crux has ES6-style or Python-style modules. But a Rust-style "crate" model could avoid some of the issues around orphan instances.
However, it does completely destroy the semantics and sequencing of global initializers.