Hello,

I'm trying to use type hints in protocols and records, but I found
some strange behavior.

As an example, if I use:

(defprotocol test
  (test-fn [a ^String b]))

the type hint in test-fn is parsed correctly (or at least without
raising an error), but then...

(defrecord test-record [x y z]
  test
  (test-fn [a  b] b))

user=> (def q (test-record. 1 2 3))
#'user/q
user=> (test-fn q 1)
1

...it is not used or even enforced when I implement the protocol
within a record.
If I use a compatible type hint in the record definition, I have an
error

(defrecord test-record [x y z]
  test
  (test-fn [a ^String b] b))

java.lang.IllegalArgumentException: Can't find matching method:
test_fn, leave off hints for auto match.

It is not clear to me if type hints are supported in protocols, and if
so, how I can use them.

thanks in advance, Francesco

-- 
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