Skip to content

Problem with reader literals and tools.namespace #11

@mmower

Description

@mmower

Hi Jake.

So a problem has popped up that appears to be related to the use of tools.namespace for reloading (I'm reporting some detective work by llasram in #clojure here):

Ok, so usually namespaces are created on-demand and never removed
When clojure.core is first loaded and initialized data-readers, it creates
namespaces and vars for all the referenced reader functions, which will
be at that point unbound
Normally, when you then load a namespace, if the namespace object
already exists, it just creates/updates the bindings for vars in the namespace
But the tools.namespace reload code is destroying the namespace itself,
and creating a new one to then load code into
The data-readers map is left holding a var in a namespace object which
no-one else can see, and never gets new code loaded into it

The net result is that if you try and use a reader literal in your test code you get an exception, see: https://www.refheap.com/85727 which you don't get in normal use or from the REPL.

Any thoughts?

m/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions