core.typed

Consider renaming add-to-alias-env's first arg (currently &form)

Details

  • Type: Enhancement Enhancement
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None

Description

The change I am suggesting here may be a bug, and I simply do not realize it yet.

clojure.core/defn checks whether the first arg is called

&form
, and if so, it removes the first two args from the arg vector to create the value for the :arglists key of the var's metadata. I believe this is because almost every time the first arg is called
&form
, it is a function created by a macro definition, and the first two args are
&form &env
, and Clojure programmers would typically prefer not to see those hidden args when they do (doc name-of-macro).

Function clojure.core.typed/add-to-alias-env has a first arg

&form
, and thus its :arglists are set to
[t]
rather than
[&form qsym t]
. I don't think there is any bug here, but if it is correct to change the name of the first arg to something else, e.g.
form
, the :arglists would be closer to what one would expect.

The only reason I noticed this is due to a bunch of :wrong-arity warnings from Eastwood when linting core.typed, since the situation described above means that it appears that all calls to add-to-alias-env with the correct number (3) of args appear to be the wrong number of args.

Activity

Hide
Andy Fingerhut added a comment -

Patch ctyp-153-vv1.diff renames the first arg of add-to-alias-env from &form to form.

Show
Andy Fingerhut added a comment - Patch ctyp-153-vv1.diff renames the first arg of add-to-alias-env from &form to form.
Hide
Ambrose Bonnaire-Sergeant added a comment -

Thanks, renamed.

Show
Ambrose Bonnaire-Sergeant added a comment - Thanks, renamed.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: