Definitions

Basic Storm supports the following definitions. The definitions may occur at the top-level (after any use statements) or inside type definitions unless otherwise noted. The list contains a short example of the syntax. More information about each type of declaration can be found by following the link in the list.

Syntax extensions may add other types of definitions by adding productions to the SPlainFileItem for the top-level, or for SClassWrapItem for types.

Visibility Modifiers

In general, it is possible to specify the visibility for individual definitions by prepending one of the keywords public, private, package, or protected. If none is specified, the default is public. For top-level definitions, they have the following meaning:

For definitions inside a type, they have the following meaning:

If multiple definitions should have the same visibility, it is possible to specify the visibility once, before all definitions as follows:

private:

void f1() {}

void f2() {}

public:

void f3() {}

In this case, both f1 and f2 will be private, while f3 is public. This approach works both inside types, and at the top level. It is also possible to temporarily override the new default by specifying access before an individual definition:

private:

package void f1() {}

void f2() {}

Above, f1 will be package while f2 will be private.

Note: the on <thread> decorator for functions and classes can be used similarly to how visibility modifiers can be used. That is, it is possible to specify on Compiler: once in the source file, and have all functions and types be affected automatically.