<< Back to previous view

[CLJ-178] Reloading core.clj from REPL fails with print-method exception Created: 24/Aug/09  Updated: 26/Jul/13  Resolved: 28/Sep/10

Status: Closed
Project: Clojure
Component/s: None
Affects Version/s: None
Fix Version/s: Backlog

Type: Defect
Reporter: Anonymous Assignee: Unassigned
Resolution: Completed Votes: 0
Labels: None


 Description   

Example REPL session:

(in-ns 'clojure.core)
(def source-file "/path/to/clojure/src/clj/clojure/core.clj")
(load-string (slurp source-file))
</code></pre>

Result:
<pre><code>
java.lang.IllegalArgumentException: No method in multimethod 'print-method' for dispatch value: class clojure.lang.Var
Exception in thread "main" java.lang.IllegalArgumentException: No method in multimethod 'print-method' for dispatch value: class java.lang.String
        at clojure.lang.MultiFn.getFn(MultiFn.java:115)
        at clojure.lang.MultiFn.invoke(MultiFn.java:161)
        at clojure.core$pr_on__1315.invoke(Unknown Source)
        at clojure.core$pr__1318.invoke(Unknown Source)
        at clojure.lang.AFn.applyToHelper(AFn.java:173)
        at clojure.lang.RestFn.applyTo(RestFn.java:137)
        at clojure.core$apply__183.doInvoke(Unknown Source)
        at clojure.lang.RestFn.invoke(RestFn.java:428)
        at clojure.core$print__1332.doInvoke(Unknown Source)
        at clojure.lang.RestFn.invoke(RestFn.java:413)
        at clojure.core$printf__2285.doInvoke(Unknown Source)
        at clojure.lang.RestFn.invoke(RestFn.java:428)
        at clojure.main$repl_prompt__6713.invoke(main.clj:41)
        at clojure.main$repl__6737.doInvoke(main.clj:199)
        at clojure.lang.RestFn.invoke(RestFn.java:426)
        at clojure.main$repl_opt__6777.invoke(main.clj:251)
        at clojure.main$main__6812.doInvoke(main.clj:338)
        at clojure.lang.RestFn.invoke(RestFn.java:402)
        at clojure.lang.Var.invoke(Var.java:355)
        at clojure.lang.AFn.applyToHelper(AFn.java:171)
        at clojure.lang.Var.applyTo(Var.java:476)
        at clojure.main.main(main.java:37)


 Comments   
Comment by Assembla Importer [ 28/Sep/10 3:34 PM ]

Converted from http://www.assembla.com/spaces/clojure/tickets/178

Comment by Assembla Importer [ 28/Sep/10 3:34 PM ]

stu said: Core is special, and it may be that this is not possible in general (across all combinations of source/compilation that could be extant on the classpath). Here's what I get with today's master:

java.lang.IllegalArgumentException: Can't define method not in interfaces: nth (gvec.clj:83)
Comment by Assembla Importer [ 28/Sep/10 3:34 PM ]

stu said: Notes:

  • Moving print-initialized to the top of core.clj does not fix this problem
  • You can avoid this problem by putting the clojure src and classes directories (and not the compiled clojure.jar on your classpath), and compiling only the java bits
  • Disregard my previous comment, that was local weirdness in my environment.

I am ok with the workaround but if there is an easy fix let's make it.

Comment by Assembla Importer [ 28/Sep/10 3:34 PM ]

richhickey said: works in 1.3 master

Generated at Thu Nov 27 00:58:25 CST 2014 using JIRA 4.4#649-r158309.