What naming mistakes do AI assistants commonly make in EK9?

← Variable Naming Rules and Conventions · Ref: Q927

AI assistants (ChatGPT, Copilot, Claude) constantly generate banned variable names because they learned from Java/Python where these names are legal. The most common AI mistakes from the banned list are: temp, data, value, buffer, flag, object.

EK9 bans exactly 12 non-descriptive names (E11031): temp, tmp, flag, flg, data, dat, object, obj, value, val, buffer, buf. These are case-insensitive. Names like result, count, item, input, output, status, str, num, index, list, map, set, key, state, type, config, param, arg, var, ret, res are NOT banned.

Separately, E11032 bans operator keywords as variable names: empty, length, contains, abs, sqrt, close, matches.

AI FIX TABLE (for the 12 actually banned names):
- AI writes 'temp'/'tmp' -> fix to 'swapHolder' or 'intermediateResult'
- AI writes 'data'/'dat' -> fix to 'payload', 'sensorReading'
- AI writes 'value'/'val' -> fix to 'price', 'threshold', 'measurement'
- AI writes 'flag'/'flg' -> fix to 'isEnabled', 'hasPermission'
- AI writes 'object'/'obj' -> fix to 'customer', 'sensorDevice'
- AI writes 'buffer'/'buf' -> fix to 'readChunk', 'outputAccumulator'

ALWAYS ALLOWED EXCEPTIONS:

- Single-character: x, y, z, i, j, k (math variables, loop counters)
- Compound words: dataProcessor, resultSet, countdownTimer
- Descriptive: customerName, orderTotal, retryLimit

Example

defines module qa.naming.aimistakes

  defines function

    <?-
      Shows AI-corrected naming patterns.
    -?>
    fetchSensorData() as pure
      <- payload as String: "temperature=22.5"

    calculateTotal() as pure
      ->
        unitPrice as Float
        orderQuantity as Integer
      <- orderTotal as Float: unitPrice * #^ orderQuantity

  defines program

    AiMistakesDemo()
      stdout <- Stdout()

      // AI would write: data <- fetchSensorData()   BANNED
      // FIXED: descriptive name
      payload <- fetchSensorData()
      stdout.println(`Payload: ${payload}`)

      // AI would write: result <- calculateTotal(...)   BANNED
      // FIXED: descriptive name
      orderTotal <- calculateTotal(29.99, 3)
      stdout.println(`Total: ${orderTotal}`)

      // AI would write: count <- 5   BANNED
      // FIXED: descriptive name
      retryAttempt <- 5
      stdout.println(`Retries: ${retryAttempt}`)

      // Compound words: ALLOWED
      dataProcessor <- "xml"
      resultCache <- "warm"
      stdout.println(`Processor: ${dataProcessor}, Cache: ${resultCache}`)

      // Single-char math: ALLOWED
      x <- 1.0
      y <- 2.0
      stdout.println(`Point: ${x}, ${y}`)

Common mistakes

E11031 — The non-descriptive name 'data' is banned by E11031; use a descriptive name such as 'payload' instead. See ek9 -h E11031 for details.

Incorrect:

      data <- fetchSensorData()
      stdout.println(`Payload: ${data}`)

Correct:

      payload <- fetchSensorData()
      stdout.println(`Payload: ${payload}`)
Other ways to ask this
  • Why does AI-generated EK9 code fail with E11031?
  • What banned names do LLMs use most often?
  • How do I fix AI naming errors in EK9?

Keywords: fix, banned, mistake, LLM, common, E11031, AI, naming