Which module names are reserved in EK9?

← Syntax and Structure Rules · Ref: Q852

The org.ek9.lang and org.ek9.math namespaces are reserved for EK9 built-in types. User code must use different module names. Attempting to define a module in these namespaces raises E01020.

WHY RESERVED

Built-in types like String, Integer, Boolean, List, and Dict live in org.ek9.lang. Mathematical types and functions live in org.ek9.math. Allowing user code in these namespaces would create conflicts with built-in type definitions and break the bootstrap process.

RESERVED NAMESPACES

- org.ek9.lang (core types: String, Integer, Boolean, List, Dict, etc.)
- org.ek9.math (mathematical types and functions)

CORRECT MODULE NAMES

- com.mycompany.myproject
- qa.syntax.example
- app.services.auth

INCORRECT MODULE NAMES

- org.ek9.lang (E01020)
- org.ek9.math (E01020)

The rule is exact: only these two names are reserved. org.ek9.lang.custom, org.ek9.math.extra and other org.ek9 modules are ordinary module names.

See Q10 for module structure. See Q851 for reference syntax. See Q14 for package organization.

Example

defines module qa.syntax.reserved.modules

  defines function

    <?-
      Simple function in a user namespace.
      Reserved namespaces org.ek9.lang and org.ek9.math cannot be used.
    -?>
    getVersion() as pure
      <- rtn <- "1.0.0"

  defines program

    ReservedModuleDemo()
      stdout <- Stdout()

      //Reserved namespaces: org.ek9.lang, org.ek9.math
      //User code must choose different module names
      stdout.println(`Version: ${getVersion()}`)

Common mistakes

E01020 — The org.ek9.lang namespace is reserved for EK9 built-in types. Choose a different module name for your code. See ek9 -h E01020 for details.

Incorrect:

defines module org.ek9.lang

Correct:

defines module qa.syntax.reserved.modules
Other ways to ask this
  • What is E01020 in EK9?
  • Can I use org.ek9.lang as my module name?
  • What namespaces are reserved for built-in types?
  • Why does my module name cause a compiler error?
  • What module names are reserved in EK9?
  • What is E01020 invalid module name?
  • Why can I not use org.ek9 as my module name?
  • Which module namespaces are reserved in EK9?

Coming from another language?

Java: java.lang is reserved by convention (JLS prohibits it). Python: no reserved package names (but shadowing stdlib is a common bug). Rust: std is reserved. Go: no reserved paths (but shadowing stdlib is discouraged). EK9: org.ek9.lang and org.ek9.math are reserved at compile time, E01020 enforced.

Keywords: conflict, library, org.ek9.lang, syntax, module, standard, org.ek9, E01020, bootstrap, name, built-in, org.ek9.math, namespace, reserved