(def v) with no init supplied destroys #'v metadata

Description

(def a) destroys #'a metadata, check this:

If this is not a bug but a "feature", then we have at least two problems:

1- The def special form documentation doesn't state this behaviour at all, it needs to be clarified. With the current documentation it seems as doing a def with no init supplied will not make any side-effect at all, and this is not true for the var metadata.

2- defmulti uses this form to lookup the var and check if it already binds to a MultiFn, if that is the case then defmulti does nothing... but it really does something, defmulti will destroy the original var metadata in the (supposedly non-destructive) check. This is the involved defmulti fragment:

Environment

None

Status

Assignee

Unassigned

Reporter

nahuel

Labels

None

Approval

Triaged

Patch

None

Affects versions

Priority

Minor
Configure