singleton

Access the shared instance through INSTANCE.

Example.kalm
singleton Settings:
    fun title() -> Text = "Kalm"

pub fun title() -> Text = Settings.INSTANCE.title()
Example.kalm
singleton Settings {
    fun title() -> Text = "Kalm"
}

pub fun title() -> Text = Settings.INSTANCE.title()
Example.kalms
singleton Settings:
    fun title() -> Text = "Kalm"

fun title() -> Text = Settings.INSTANCE.title()
Example.kalms
singleton Settings {
    fun title() -> Text = "Kalm"
}

fun title() -> Text = Settings.INSTANCE.title()
Example.java
final class Settings {
    public static final Settings INSTANCE = new Settings();

    private Settings() {}

    public final String title() {
        return "Kalm";
    }
}

public final class Example {
    public static String title() {
        return Settings.INSTANCE.title();
    }
}

Learn more.