Clojure

Reloading core.clj from REPL fails with print-method exception

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: Backlog
  • Component/s: None
  • 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)

Activity

Hide
Assembla Importer added a comment -
Show
Assembla Importer added a comment - Converted from http://www.assembla.com/spaces/clojure/tickets/178
Hide
Assembla Importer added a comment -

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)
Show
Assembla Importer added a comment - 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)
Hide
Assembla Importer added a comment -

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.

Show
Assembla Importer added a comment - 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.
Hide
Assembla Importer added a comment -

richhickey said: works in 1.3 master

Show
Assembla Importer added a comment - richhickey said: works in 1.3 master
Alex Miller made changes -
Field Original Value New Value
Fix Version/s Approved Backlog [ 10034 ]
Fix Version/s Backlog [ 10035 ]

People

  • Assignee:
    Unassigned
    Reporter:
    Anonymous
Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: