3 ms·
In addition to the many other languages listed here, Go allows side effects on import.
by pcwalton 13y ago
In addition to the many other languages listed here, Go allows side effects on import.
- colin_mccabe 13y agoThat's interesting. I can see the motivation... it's helpful to have modules come into the world fully initialized, and initialization often involves side effects. Is Rust going to allow side effects on initialization?
- pcwalton 13y agoNo. Having module import perform side effects delays program startup unnecessarily and makes the semantics of the program depend on the order in which modules got initialized, which is confusing.