Why does EK9 report E06260 when defining package properties?

← Classes and OOP · Ref: Q955

A package block holds only the properties a package defines, each with one shape. 'version' is a VersionNumber literal, 'description' and 'license' String literals, 'publicAccess', 'applyStandardIncludes' and 'applyStandardExcludes' Boolean literals; 'tags', 'includeFiles', 'excludeFiles' and 'capabilities' are a List of String literals, and 'deps', 'devDeps' and 'excludeDeps' a Dict of (String, String) literals. The wrong kind of literal (version <- "1.0.0", publicAccess <- "yes"), an expression instead of a literal (version <- 1 + 2), the wrong shape (tags <- "tools") or a property name the package does not define triggers E06260. There is no 'name' property: the module name IS the package name. If a package is declared, 'description' is mandatory (E50001 when it is missing).

PACKAGE PROPERTY SHAPES

  version <- 1.0.0-0             // VersionNumber literal
  description <- "My package"    // String literal
  license <- "MIT"               // String literal
  publicAccess <- true           // Boolean literal
  tags <- ["tools"]              // List of String literals
  deps <- {"a.b": "1.0.0-0"}     // Dict of (String, String) literals

WHY ENFORCED

Package metadata is used by the build system and dependency management. Invalid shapes would break version resolution, licensing, and publication. The compiler, the language server and every tool check each property the same way, before compiling.

See Q10 for module structure. See Q852 for reserved module names. See Q14 for package organization.

Example

defines module qa.classes.paramtypemismatch

  defines package

    version <- 1.0.0-0
    description <- "Demonstrates correct package property types"
    license <- "MIT"
    tags <- ["examples"]

  defines program

    PackagePropertyDemo()
      stdout <- Stdout()
      stdout.println("Package properties use strict types")
      stdout.println("version: VersionNumber, description: String")

Common mistakes

E06260 — A package version is a VersionNumber literal (major.minor.patch-build), not a String; quoting it makes it a String literal of the wrong kind. See ek9 -h E06260 for details.

Incorrect:

    version <- "1.0.0-0"

Correct:

    version <- 1.0.0-0

E06260 — A package description must be a String literal; an Integer (or any other kind of literal) is rejected. See ek9 -h E06260 for details.

Incorrect:

    description <- 12

Correct:

    description <- "Demonstrates correct package property types"

E06260 — 'tags' is a List of String literals, even for a single tag - a lone String is the wrong shape. The same holds for includeFiles, excludeFiles and capabilities. See ek9 -h E06260 for details.

Incorrect:

    tags <- "examples"

Correct:

    tags <- ["examples"]

E06260 — There is no 'name' package property - the module name IS the package name - so 'name' is unusable, as is any name the package does not define. See ek9 -h E06260 for details.

Incorrect:

    license <- "MIT"
    name <- "qa.classes.paramtypemismatch"

Correct:

    license <- "MIT"
Other ways to ask this
  • What triggers E06260 PARAMETER_MISMATCH in packages?
  • Why must package version be a VersionNumber type?
  • How do I correctly declare package properties?
  • Can I give a package a name property?

Coming from another language?

Java: pom.xml version is a free-form string. Python: setup.py version is a string. Rust: Cargo.toml version uses semver strings. Go: go.mod uses semver tags. EK9: version is a typed VersionNumber literal validated at compile time, E06260 if wrong type.

Keywords: mismatch, package, metadata, version, parameter, VersionNumber, property, type, E06260, build