Packages¶
Packages prevent conflicts when multiple files have declarations with the same name. They accomplish this by grouping all declarations in a file into a namespace. All Safe-DS programs must declare their package at the beginning of the file. Here is an example:
It has these syntactic elements:
- The keyword
package
. - The name of the package. It consists of multiple parts separated by dots. Each part can be any combination of lower- and uppercase letters, underscores, and numbers, as long as it does not start with a number.
Name convention
- Use
lowerCamelCase
for all parts. - Use the reverse domain name notation for the package name.
Multiple files can belong to the same package. However, within the same package the names of declarations must be unique.