Every file in Mochaccino is a package. It can contain functionality for a specific feature, or be part of a bigger feature.
package
The package keyword is used to define the name of that package (file), which other packages can use when referring to it.
include
The include keyword is used to import other packages from the same project into the current package.
package demopack;
include somePack;
include somePack2;
The objects exposed by the included packages will be imported directly, and you do not need to use a prefix to access them.
package demopack;
include somePack;
include somePack2;
someMethod(); // a method defined in somePack
But what if you want to import a file that is not from the project, or one that is hosted on Github? The dock keyword is the tool for this job.
dock
The dock keyword declares a list of imports separated by commas.
package demopack;
include somePack;
include somePack2;
dock {
foo from"github.com/..."as f,
* from"Users/Me/files/code.moc",
"Users/Me/files/moreCode.moc",
}
from
The from keyword seen above allows you to import specific modules or structs from the file in question.
as
The as keyword defines an alias for the imported package or objects. The defined prefix needs to be used to access objects from that package or the package itself.