zilch-lang/zilch

Modules

Closed this issue · 0 comments

Originally described by @Mesabloo in zilch-lang/specification#12.

Modules offer easy code reuse and are a much preferred alternative to C's #include.
The basic semantics is:

  • A .zc file is a module whose name is determined based on the include path
  • A Zilch file may optionally start with an export clause to tell what is exported (similar to JS' module.exports).
    Absence of such clause means that nothing is exported from the module.
  • A module can also contain import clauses which describe what modules will be used by the source code as well as which specific part of them (e.g. only a given effect) will be used.