Reloading a defmulti nukes metadata on the var

Description

Reloading a defmulti expression destroys any existing (or new) metadata on that multimethod's var:

This is highly problematic for tools.analyzer, since it relies on such metadata to convey information to the pass scheduler about pass dependencies.

This means that any code that uses core.async cannot be reloaded using `require :reload-all`, since it will cause tools.analyzer to reload and the passes to scheduled in a random order. See for one example.

Cause: defmulti has defonce semantics and the first def does not re-apply meta.

Approach: Re-apply meta before first def.

After patch:

Patch: 0001-CLJ-1870-don-t-destroy-defmulti-metadata-on-reload.patch

Screened by: Alex Miller

Environment

None

Activity

Show:
Nicola Mometto
December 23, 2015, 5:06 PM

Updated patch fixing the typo & using -U10

Alex Miller
December 23, 2015, 5:17 PM

Now:

java.lang.RuntimeException: Too many arguments to def, compilingclojure/core.clj:3561:1)

Nicola Mometto
December 23, 2015, 5:22 PM

whoops. Sorry for this, here's the updated (and working) patch

Alex Miller
August 19, 2016, 4:58 PM

patch doesn't apply with new def spec, needs another look

Alex Miller
August 19, 2016, 5:16 PM

I had an old version of the patch locally - nvm!

Completed

Assignee

Unassigned

Reporter

Nicola Mometto

Approval

Ok

Patch

Code

Fix versions

Priority

Critical
Configure