cruxlang / crux

Crux Programming Language
http://cruxlang.org
Other
51 stars 2 forks source link

explore a "crate" model #143

Open chadaustin opened 8 years ago

chadaustin commented 8 years ago

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.

chadaustin commented 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.

chadaustin commented 8 years ago

Perhaps lazy initialization of globals could avoid the initialization order problem, at the cost of code size.