What are the parameter count and line length limits in EK9?

← Code Quality · Ref: Q700

EK9 has no direct parameter-count limit and no line-length check. What it does check is how calls pass their arguments, and parameter lists that repeat across functions.

WHAT IS CHECKED

- E11062: a call that passes 4 or more arguments positionally - name them (Q694).
- E11061: a call that passes 2 or more Boolean literals positionally - name them (Q694).
- E11010: more than 20 arguments in a single call is a hard stop ('arguments is too many').
- E11053: a data clump - the same group of parameters repeated across functions - extract a record to group them.
A function declared with 7 parameters compiles, as long as its callers name the arguments.

LINE LENGTH

The compiler never rejects a long line. EK9's formatter wraps lines at 120 characters, but that is formatting, not a compile error.

NOT THESE CODES

E11020 is combined complexity and size (complexity ratio x statement ratio above 0.50), and E11040 is too many injected fields. Neither is about parameters or line length.

CORRECT PATTERNS

1. Group related parameters into a record or class (as ShippingAddress does below)
2. Use builder or configuration patterns
3. Split long expressions across multiple lines
4. Extract intermediate values into named variables

PARAMETER GROUPING

Instead of a createOrder with seven separate parameters (name, street, city, postal code, item, quantity, price), group them into meaningful types - a Customer record and an OrderItem record - so createOrder takes two parameters.

See Q316 for complexity metrics. See Q696 for complexity limits. See Q694 for named arguments.

Example

defines module qa.codequality.parametercountlimits

  defines record

    <?-
      Group related data into a record.
      This reduces parameter count in function signatures.
    -?>
    ShippingAddress
      streetAddress as String?
      cityName as String?
      postalCode as String?

      default private ShippingAddress()

      ShippingAddress()
        ->
          streetAddress as String
          cityName as String
          postalCode as String
        this.streetAddress :=? streetAddress
        this.cityName :=? cityName
        this.postalCode :=? postalCode

      default operator $
      default operator ?

  defines function

    <?-
      Correct: 2 parameters instead of 6.
      Related data grouped into records.
    -?>
    formatShipping() as pure
      ->
        customerName as String
        shippingAddress as ShippingAddress
      <- label as String: customerName

      if shippingAddress?
        label: `${customerName}: ${shippingAddress}`

    <?-
      Correct: 3 parameters, within limits.
      Each parameter serves a distinct purpose.
    -?>
    calculateDiscount() as pure
      ->
        originalPrice as Float
        discountRate as Float
        minimumPrice as Float
      <- finalPrice as Float: originalPrice

      discountedPrice <- originalPrice * (1.0 - discountRate)

      if discountedPrice >= minimumPrice
        finalPrice: discountedPrice

  defines program

    ParameterCountLimitsDemo()
      stdout <- Stdout()

      addr <- ShippingAddress("123 Main St", "Springfield", "62701")
      label <- formatShipping("Alice", addr)
      stdout.println(label)

      price <- calculateDiscount(100.0, 0.2, 10.0)
      stdout.println(`Final price: ${price}`)

Common mistakes

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

Incorrect:

label <- formatShipping("Alice", addr).toUpperCase()

Correct:

label <- formatShipping("Alice", addr)

E50060 — Float has no toString() method; use the '$' prefix operator or '${...}' interpolation to convert to String. See ek9 -h E50060 for details.

Incorrect:

stdout.println(price.toString())

Correct:

stdout.println(`Final price: ${price}`)
Other ways to ask this
  • Is there an error for too many parameters in EK9?
  • Does EK9 reject lines that are too long?
  • How many parameters can a function have?
  • What is the maximum line length in EK9?

Coming from another language?

Java: no parameter count enforcement (only static analysis). Python: no enforcement. C++: no enforcement. Rust: Clippy warns about parameter count. Go: no enforcement. EK9: no parameter-count or line-length error; calls with 4+ positional arguments (E11062) or 20+ arguments (E11010) and repeated parameter groups (E11053) are compile errors; the formatter wraps at 120 characters.

Keywords: E11053, limit, line, E11062, count, length, quality, readable, metric, parameter, clean-code, E11010