Modules

A module is a named unit of encapsulation which may contain items and other modules.

Module ::= mod Name { Item* }

A currently unsupported but planned feature is to allow modules to form a hierarchy through nesting. This hierarchy is in addition tied to the file system hierarchy (similar to Rust):

my-project/
  src/
    main.arc     # :: (root module)
    foo/
      mod.arc    # ::foo
      bar/
        mod.arc  # ::foo::bar
    baz/
      mod.arc    # ::foo::baz

Examples

{{#include ../../../arc-lang/examples/modules.arc:example}}