Why does the compiler reject my variable name?
← Variable Naming Rules and Conventions · Ref: Q291
EK9 rejects variable names that are non-descriptive or shadow operators. Each error code tells you exactly what category of restriction you hit.
E11031: NON-DESCRIPTIVE VARIABLE NAME
You used one of: temp, tmp, flag, flg, data, dat, object, obj, value, val, buffer, buf. The check is case-insensitive. Fix: describe what the variable represents. Instead of temp use swapHolder or intermediateResult. Instead of flag use isComplete or shouldRetry. Instead of data use customerRecord or sensorReading. Instead of value use totalPrice or measuredWeight. Instead of buffer use outputBuilder or readChunk.
E11032: OPERATOR KEYWORD AS VARIABLE NAME
You used one of: empty, length, contains, abs, sqrt, close, matches. These shadow built-in operators. Fix: add context. Instead of empty use isBlank or emptyBasket. Instead of length use nameLength or pathSize. Instead of contains use hasItem or includesKey. Instead of matches use foundItems or searchHits. Instead of abs use absoluteDistance. Instead of close use closeFile or shutdownConnection.
E01060: RESERVED WORD AS IDENTIFIER
You used assert, require, assertThrows, or assertDoesNotThrow. These are reserved for the testing framework. Fix: use testResult, precondition, or validationCheck instead.
E01070-E01080: EXCLUDED KEYWORD
You used break, continue, return, null, goto, new, def, elif, None, or self. These keywords do not exist in EK9. Fix: these are not just naming issues, they indicate you are thinking in another language. See Q144 for why EK9 has no break, continue, or return.
QUICK FIX TABLE
temp/tmp -> swapHolder, intermediateResult, pendingEntry flag/flg -> isComplete, hasPermission, shouldRetry data/dat -> customerRecord, sensorReading, responsePayload object/obj -> currentItem, targetEntity, parsedElement value/val -> totalPrice, measuredWeight, userInput buffer/buf -> outputBuilder, messageAccumulator, readChunk empty -> isBlank, emptyBasket, noResults length -> nameLength, pathSize, messageCount contains -> hasItem, includesKey, foundMatch matches -> foundItems, matchingRecords, searchHits
See Q290 for the complete banned list. See Q297 for a comprehensive renaming guide. See Q248 for all error codes.
Example
defines module qa.naming.troubleshoot defines function processOrder() as pure -> orderTotal as Float customerName as String <- receiptMessage as String: `Order for ${customerName}: ${orderTotal}` calculateDiscount() as pure -> originalPrice as Float discountRate as Float <- discountedPrice as Float: originalPrice * (1.0 - discountRate) retryUntilDone() -> maxAttempts as Integer <- attemptCount as Integer: 0 isRetryNeeded <- Boolean(true) while isRetryNeeded and attemptCount < maxAttempts attemptCount++ if attemptCount >= maxAttempts isRetryNeeded: false defines program TroubleshootNamingDemo() stdout <- Stdout() // === FIXED E11031: temp -> swapHolder === firstNumber <- 10 secondNumber <- 20 swapHolder <- firstNumber firstNumber := secondNumber secondNumber := swapHolder stdout.println(`After swap: ${firstNumber}, ${secondNumber}`) // === FIXED E11031: flag -> isRetryNeeded === attemptCount <- retryUntilDone(3) stdout.println(`Attempts: ${attemptCount}`) // === FIXED E11031: data -> customerRecord === customerRecord <- "Alice:Premium:2024" stdout.println(`Record: ${customerRecord}`) // === FIXED E11032: empty -> emptyBasket === emptyBasket <- List() of String stdout.println(`Empty basket: ${emptyBasket}`) // === FIXED E11032: length -> nameLength === greeting <- "Hello, World" nameLength <- length greeting stdout.println(`Name length: ${nameLength}`) // === COMBINED EXAMPLE: GOOD NAMING THROUGHOUT === originalPrice <- 100.0 discountRate <- 0.15 finalPrice <- calculateDiscount(originalPrice, discountRate) receiptMessage <- processOrder(finalPrice, "Alice") stdout.println(receiptMessage)
Common mistakes
E11031 — The name 'temp' is non-descriptive and banned by the compiler. Use 'swapHolder' or another name that describes the variable's purpose. See ek9 -h E11031 for details.
Incorrect:
temp
Correct:
swapHolder
E11032 — The name 'length' shadows a built-in operator keyword and is rejected. Use a descriptive alternative like 'nameLength'. See ek9 -h E11032 for details.
Incorrect:
length
Correct:
nameLength
E11031 — The name 'data' is non-descriptive and banned. Use a name like 'customerRecord' that describes what the data represents. See ek9 -h E11031 for details.
Incorrect:
data
Correct:
customerRecord
Other ways to ask this
- How do I fix E11031 non-descriptive variable name error?
- How do I fix E11032 operator keyword as variable name error?
- What should I rename my rejected variable to in EK9?
Coming from another language?
Java: no compile-time naming enforcement, Checkstyle rules are optional and configurable. Python: no naming enforcement, PEP 8 is advisory. Rust: no naming enforcement beyond snake_case warnings. Go: no naming enforcement, golint is advisory. C/C++: no naming enforcement. Kotlin: no naming enforcement. JavaScript: ESLint naming rules are optional. EK9: compiler enforces naming at compile time, cannot be disabled, four tiers of restrictions with specific error codes.
Keywords: naming, E11031, E11032, error, why, identifier, troubleshoot, E01060, compiler, banned, reject, rename, variable, fix, compile, convention