[ ] Write rules for Zom name mangling and put them into the book, then implement it (probably create its own issue)
[ ] Item visibility, visibility identifier
[ ] private, the item can only be called from the current, module, it's the default when pub isn't specified.
[ ] public, the item is usable in the whole package and packages that use it, use the pub keyword in front of the item.
[ ] export, when using export in front of an Item, the name mangling is disabled, and the symbol is exported. It's meant to facilitate interop with C. And because names aren't mangled, an error is omitted if to exported symbol have the same name
[ ] Modules can be declared, in another module, like that
mod childmod {
// items ...
}
module declaration is an item so it can have a visibility identifier. Modules can also be declaraded from another file, like that:
mod modfile;
The global path of an Item is the path of it's container plus it's name. And the the path of the primary module is the name of the package. The primary module, is the path given to the first source file of a package. e.g:
Clarify, packages, modules, create an import system in Zom:
to import scope of the println function in the module. You can reexport symbols to another scole, with public imports,
pub
isn't specified.pub
keyword in front of the item.export
in front of an Item, the name mangling is disabled, and the symbol is exported. It's meant to facilitate interop with C. And because names aren't mangled, an error is omitted if toexport
ed symbol have the same namemodule declaration is an item so it can have a visibility identifier. Modules can also be declaraded from another file, like that:
fn main() void {} // => example.main
pub mod somecode { fn hello() void { ... } // => example.somecode.hello }