What module names are reserved in EK9?

← Syntax and Structure Rules · Ref: Q727

The entire 'org.ek9.*' namespace is reserved for the EK9 standard library. User code cannot define modules in this namespace. Attempting to do so triggers E01020.

RESERVED PREFIX

Any module name starting with 'org.ek9.' is reserved:
- org.ek9.lang (core language types: String, Integer, List)
- org.ek9.math (mathematical types and functions)
- org.ek9.* (any other org.ek9 sub-module)

VALID MODULE NAMES

Use your own namespace:
- com.mycompany.myproject
- net.example.utils
- my.application
- any.name.not.starting.with.org.ek9

WHY RESERVED

The org.ek9 namespace contains the standard library types that the compiler relies on. Allowing user code in this namespace would risk name collisions with built-in types and could break compiler assumptions.

See Q6 for module organization. See Q13 for packages vs modules.

Example

defines module qa.syntaxrules.reservednames

  defines function

    greetUser() as pure
      -> name as String
      <- rtn as String: "Hello, " + name

  defines program

    ReservedNamesDemo()
      stdout <- Stdout()

      //This module uses a valid namespace
      stdout.println(greetUser("Steve"))
      stdout.println("Module qa.syntaxrules.reservednames is valid")
      stdout.println("Module org.ek9.anything would be rejected")

Common mistakes

E50060 — String has no toUpperCase() method in EK9. Use upperCase() instead. See ek9 -h E50060 for details.

Incorrect:

stdout.println(greetUser("Steve").toUpperCase())

Correct:

stdout.println(greetUser("Steve"))
Other ways to ask this
  • 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.* and javax.* packages reserved for JDK. Python: no reserved namespaces but conventions exist. Go: standard library packages in specific paths. Rust: std crate is reserved. C#: System namespace is reserved. EK9: org.ek9.* reserved for standard library, compiler error if violated.

Keywords: reserved, name, module, namespace, syntax, org.ek9, standard, E01020, library