module Modules {
// MODULES AND IMPORT BASICS
// use module to define a new set of related definitions.
//
// use import to use definitions between modules. import
// allows relative paths like a URL. the path is based on the
// program namespace (not the file system).
//
// fully qualified paths can be used in expressions and types.
//
// the root path / indicates the current project.
import { ./A; ./A/B; /; }
module A {
import { ../C; }
module B {
import { ..; }
struct T1 { }
fn test() => {
let x : ../../C.T2;
let y : /Namespaces/Modules/C.T2;
../../C.test();
}
}
}
module C {
struct T2 {}
fn test() => {
}
}
}
// PUBLIC MODULES
// • by default, modules are private
// • private modules modules may only be imported by immediate parent and siblings of the module
// • modules can be made public using pub name : module {}
// SHREDDED MODULES
// when a file called module.3l is present in a folder, it implies that all definitions in that
// folder are part of the module defined in the file. there should only be a single
// module defined in this case. this is refered to as a "shredded" module.