Skip to content

63 Visibility ​

heading is public and can be imported into Main.norm. prefix is private to its declaring file; callers use the public function instead of importing that helper.

Entry file app/Main.norm:

norm
package app

import app.tools.heading

main() {
  printLine(heading(text: "Norm"))
}

Related file app/tools/Format.norm:

norm
package app.tools

private String prefix() { return "Language: " }

public String heading(String text) {
  return prefix() + text
}

Module description app/module.norm:

norm
Module module() {
  return module(name: "app", version: 1, exports: ["Main", "tools.Format"])
}

Run from the repository root:

sh
norm run norm/tests/docs/projects/visibility/app/Main.norm

Expected output:

text
Language: Norm

Try it: Try importing prefix in Main.norm and inspect the visibility diagnostic.

Precise rules: Reference.

Norm 0.25