Clojure

Suggest alength in error message on attempt to access array length via .length

Details

  • Type: Enhancement Enhancement
  • Status: Closed Closed
  • Priority: Trivial Trivial
  • Resolution: Declined
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
  • Patch:
    Code

Description

Problem:

Newcomers are easily confused by the inability to access <array>.length via (.length <array>).

Approach:

Append to invalid field access message, a suggestion to use alength for this specific case (class.isArray and field = "length")

user=> (.length (int-array 2))
IllegalArgumentException No matching field found: length for class [I, use alength function for array length

Activity

Hide
Alex Miller added a comment -

We don't have any plans to add anything this specific to the error check, thanks.

Show
Alex Miller added a comment - We don't have any plans to add anything this specific to the error check, thanks.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: