Note: information on this page refers to Ceylon 1.0, not to the current release.
Packages
A package is a collection of toplevel declarations contained in one or more compilation units together with an optional package descriptor.
A package may belong to a module.
Usage
An example package descriptor:
shared package com.example.foo.bar;
This would occur in the source file
<source-dir>/com/example/foo/bar/package.ceylon where
<source-dir> is the directory containing ceylon source code,
conventionally source.
Description
Members
A package's members are the top-level declarations contained in its compliation unit(s).
Descriptor
The
package descriptor
holds metadata about the package and is declared in a source
file called package.ceylon in the package being described.
Here's an example:
"An example package"
shared package com.example.foo.bar;
The package declaration may be preceeded by annotations,
including:
-
sharedto allow the package to be visible outside its containing module, -
docto let you to specify package-level documentation, -
byto document the package's author or authors.
The package declaration consists of the package keyword
followed by the package name.
It is common not to have a package descriptor if the package
is not shared.
Metamodel
Packages can be manipulated at runtime via their representation as
Package instances.
See also
- Packages usually belong to modules
- Packages contain compilation units