Just noticed that defprotocol -- or rather, emit-protocol -- simply
assumes that method signatures are well-formed. This leads to the
following behaviour:

;; this compiles fine
(defprotocol PTestProt
  (p-test-method "foo" [this]))

;; this does not -- no matching method found
(defrecord RTestRec []
  PTestProt
  (p-test-method [this] :foo))

What happens (AFAICT) is that emit-protocol, upon seeing the "foo"
string in the signature for p-test-method, assumes that it's done with
that signature (because the docstring comes last, right?) and never
notices there's anything more to process; nor does it complain about
the signature being malformed. This is doubly weird if you consider
that p-test-method ends up being without a valid signature, yet it has
a docstring which (doc p-test-method) can display.

While I'm at it, I have to say that I'm wondering if having the
(optional) docstring come first, before the arglists, wouldn't be more
consistent with the way defn handles docstrings.

Sincerely,
Michał

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to