racket / racket/racket

Arity mismatch error messages should be re-written

Open
#2,880 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Racket
Stars
5.2k
Forks
698
Avg merge
18h 34m
Merged PRs (30d)
5

Description

"Arity" is an unusual name for a problem. It confuses young people and anyone who is not a math major. I took 3000 or 4000 level math classes and never used this term. Please lower the math education requirements. Children can learn this stuff if we just use better sentences. We want Racket to be accessible by all people, so wording and phrasing is an important topic.

https://en.wikipedia.org/wiki/Arity

The term "arity" is rarely employed in everyday usage. For example, rather than saying "the arity of the addition operation is 2" or "addition is an operation of arity 2" one usually says "addition is a binary operation".

It is better to use any term you can find that comes from linguistics, if there is a linguistic alternative to the math concept. A Linguistic equivalent is "valency":

In mathematics, arity may also be named rank,[1][2] but this word can have many other meanings in mathematics. In logic and philosophy, arity is also called adicity and degree.[3][4] In linguistics, arity is usually named valency.[5]

Yep, it's opaque too, so, still looking for a better answer.

What not to do: more confusing math names. Ex: Monadic, dyadic, which are used in Haskell and explained here:

Unary functions or predicates may be also called "monadic"; similarly, binary functions may be called "dyadic".

With "monadic" explained relative to "dyadic", it is more accessible, since people can relate this back to etymology (mon = 1, dy = 2), but compiler errors are never explained relative to other compiler errors, so we need a good stand-alone explanation.

Perhaps this:

The number of arguments does not match what is expected by <fn>

I am new to Racket, but I would be happy to make changes and submit a PR down the road. If someone wants to work on this faster than me, that's OK too. Assign to me and anyone else that can help.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no files or tests. Start by locating the Racket error paths that report arity mismatches, then review the existing wording and determine the full set of affected messages; done means those messages clearly explain that the supplied argument count differs from what the function expects.

Written by the indexing model from the issue text.

Assessment

Domain
accessibility, compilers
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.