technomancy / swank-clojure

Swank/slime support for clojure
Eclipse Public License 1.0
412 stars 83 forks source link

slime-compile and interface generation #56

Closed bsteuber closed 12 years ago

bsteuber commented 13 years ago

Consider this file:

(ns foo)

(defprotocol Foo
  (foo [this x]))

(defn make-foo-proxy []
  (proxy [foo.Foo] []
    (foo [x] (prn x))))

(foo (make-foo-proxy) 42)
;EDIT: fixed typo in last line

After compiling once with C-c C-k, everything works fine. However, compiling a second time yields:

No implementation of method: :foo of protocol: #'foo/Foo found for class: foo.proxy$java.lang.Object$Foo$d757b77e

Interestingly, typing (compile 'foo) in the repl fixes this for the whole session, even if I change the protocol.

purcell commented 13 years ago

Which versions of clojure and swank-clojure are you using?

purcell commented 13 years ago

BTW, this fails for me on the first compilation with C-c C-k:

1 compiler notes:

Unknown location:
  error: java.lang.IllegalArgumentException: No single method: foo of interface: foo.Foo found for function: foo of protocol: Foo

foo.clj:10:1:
  error: java.lang.IllegalArgumentException: No single method: foo of interface: foo.Foo found for function: foo of protocol: Foo (foo.clj:10)
purcell commented 13 years ago

The last line was wrong. It should read:

(foo (make-foo-proxy) 42)

Then everything seems fine to me, at least with the latest swank-clojure and clojure 1.2.

If that fixes the problem for you, please go ahead and close the issue.

-Steve

bsteuber commented 13 years ago

Oups, typed that wrong here (but not in my file). That happens (at least) with clojure 1.2.1 and swank-clojure 1.4.0-SNAPSHOT (installed as lein plugin, hope it gets automatically updated, too)

purcell commented 13 years ago

Hmm, odd, since it works for me, and my test config was very similar to yours; I have Clojure 1.2.1, swank-clojure 1.4.0-SNAPSHOT (in dev-dependencies, and dated Jun 9), all started with "lein swank". I've even tried updating to today's swank-clojure snapshot, and everything still works fine. Mysterious, eh?

Does this still fail if you restart your repl from scratch? Or is some past experiment in your instance perhaps still messing things up?

-Steve

technomancy commented 12 years ago

I can't reproduce this; feel free to reopen if it's still an issue.