What variable names are banned in EK9?

← Variable Naming Rules and Conventions · Ref: Q290

EK9 enforces naming quality at compile time across four tiers of restriction. No other mainstream language does this. Every banned name has a specific reason and error code.

TIER 1: NON-DESCRIPTIVE NAMES (E11031)

The following names are rejected because they carry no semantic meaning: temp, tmp, flag, flg, data, dat, object, obj, value, val, buffer, buf. The check is case-insensitive, so Data, DATA, and data are all rejected. Research shows these names correlate with 2.7x higher defect density.

OPERATOR KEYWORDS (E11032)

The following names shadow built-in operators and are rejected: empty, length, contains, abs, sqrt, close, matches. Using these as variable names would make the corresponding operator unusable in scope.

RESERVED WORDS (E01060)

The following are reserved for the EK9 testing framework: assert, require, assertThrows, assertDoesNotThrow. These are not available as variable or type names.

EXCLUDED KEYWORDS (E01070-E01080)

Keywords from other languages that do not exist in EK9: break, continue, return, null, goto, new, def, elif, None, self. These are excluded by design to prevent confusion when migrating from other languages.

SINGLE-CHARACTER EXEMPTION

Single-character names are always allowed: x, y, z, i, j, k, T, K, V. The compiler trusts these as intentional shorthand for mathematical variables, loop counters, and generic type parameters.

See Q291 for troubleshooting rejected names. See Q296 for research evidence behind these bans. See Q297 for a renaming guide. See Q22 for variable declarations. See Q248 for error code lookup. See Q311 for full quality checks catalog.

Example

defines module qa.naming.banned

  defines function

    calculateArea() as pure
      ->
        width as Float
        height as Float
      <- area as Float: width * height

    formatGreeting() as pure
      -> customerName as String
      <- greeting as String: "Hello, " + customerName

    isRetryNeeded() as pure
      -> attemptCount as Integer
      <- shouldRetry as Boolean?

      maxAttempts <- 3
      shouldRetry :=? attemptCount < maxAttempts

  defines program

    BannedNamesDemo()
      stdout <- Stdout()

      // === SINGLE-CHARACTER NAMES: ALWAYS ALLOWED ===

      x <- 10.0
      y <- 20.0
      z <- calculateArea(x, y)
      stdout.println(`Area: ${z}`)

      // === DESCRIPTIVE CAMELCASE: ALWAYS ALLOWED ===

      customerName <- "Alice"
      orderCount <- 5
      isActive <- true
      stdout.println(`Customer: ${customerName}, Orders: ${orderCount}, Active: ${isActive}`)

      // === COMPOUND NAMES: ALWAYS ALLOWED ===

      totalPrice <- 99.95
      retryAttempt <- 1
      outputMessage <- formatGreeting(customerName)
      stdout.println(`${outputMessage}, Price: ${totalPrice}`)

      // === GOOD ALTERNATIVES TO BANNED NAMES ===

      swapHolder <- x
      isComplete <- true
      sensorReading <- 42.5
      currentItem <- "widget"
      computedScore <- 88
      readChunk <- "packet contents"
      stdout.println(`Swap: ${swapHolder}, Done: ${isComplete}`)
      stdout.println(`Sensor: ${sensorReading}, Item: ${currentItem}`)
      stdout.println(`Score: ${computedScore}, Chunk: ${readChunk}`)

      // === GOOD ALTERNATIVES TO OPERATOR KEYWORD NAMES ===

      isBlank <- length customerName == 0
      nameLength <- length customerName
      targetItem <- 2
      hasItem <- [1, 2, 3] contains targetItem
      positiveAmount <- 42
      needsRetry <- isRetryNeeded(retryAttempt)
      stdout.println(`Blank: ${isBlank}, Length: ${nameLength}`)
      stdout.println(`Has item: ${hasItem}, Amount: ${positiveAmount}`)
      stdout.println(`Retry: ${needsRetry}`)

Common mistakes

E11031 — The name 'data' is non-descriptive and banned by the compiler. Use a name that describes what the variable represents, such as 'sensorReading'. See ek9 -h E11031 for details.

Incorrect:

data

Correct:

sensorReading

E11032 — The name 'empty' shadows a built-in operator keyword and is rejected. Use a descriptive alternative like 'isBlank'. See ek9 -h E11032 for details.

Incorrect:

empty

Correct:

isBlank

E11031 — The name 'value' is non-descriptive and banned by the compiler. Use a name that communicates what the value represents. See ek9 -h E11031 for details.

Incorrect:

value

Correct:

computedScore
Other ways to ask this
  • Which identifiers are forbidden as variable names in EK9?
  • What names trigger E11031 or E11032 in EK9?
  • What are the reserved and restricted variable names in EK9?

Coming from another language?

Java: allows any valid identifier, relies on linters like Checkstyle or SonarQube for naming rules. Python: allows any valid identifier, PEP 8 naming conventions are voluntary. Rust: allows any identifier, clippy provides optional naming warnings. Go: allows any identifier, golint suggests naming conventions. C/C++: allows any non-keyword identifier, no naming enforcement. Kotlin: allows any identifier, detekt provides optional rules. JavaScript: allows any valid identifier, ESLint rules are optional. EK9: compiler enforces naming quality with four tiers of restriction, no configuration needed, cannot be disabled.

Keywords: error, identifier, convention, banned, restricted, name, migrate, reserved, forbidden, E01060, compile, naming, variable, E11032, E11031