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.lang.custom (E01020)
- org.ek9.math.extra (E01020)

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?

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: syntax, namespace, org.ek9.lang, conflict, org.ek9.math, module, built-in, bootstrap, reserved, E01020