clj-commons / potemkin

some ideas which are almost good
577 stars 53 forks source link

Do an extra sanity check before skipping evaluation of record/type #11

Closed w01fe closed 11 years ago

w01fe commented 11 years ago

We were running into issues where a namespace didn't load the first time due to errors, and subsequent loads would fail because the class was not mapped in the namespace. This adds a sanity check for this case and always evaluates the form if the class is not mapped in the namespace.

The easiest way to reproduce the issue is to create a namespace with a defrecord+, evaluate it, remove-ns it, and evaluate the namespace again.

(ns tmp
  (:require potemkin))

(potemkin/defrecord+ Foo [x y])

Foo

at the repl:

(require 'tmp)
(remove-ns 'tmp)
(require 'tmp)