Hi all, I am puzzled by the type hint support in deftype. I can add type hints to defprotocol:
user=> (defprotocol PTest (test-it ^boolean [this ^String msg])) PTest … but adding them to deftype fails: user=> (deftype Test [^String name] PTest (test-it [this msg] (str "test " name ": " msg \space (.length msg)))) java.lang.IllegalArgumentException: Can't find matching method: test_it, leave off hints for auto match. (NO_SOURCE_FILE:1) So I write the deftype without type hints: user=> (deftype Test [^String name] PTest (test-it [this msg] (str "test " name ": " msg \space (.length msg)))) user.Test But then, I get reflection warnings: user=> (set! *warn-on-reflection* true) true user=> (test-it (Test. "one") "two") "test one: two 3" 8/31/10 11:11:49 PM [0x0-0x29029].org.fiji[382] Reflection warning, NO_SOURCE_PATH:3 - reference to field length can't be resolved. In any case "length" is a method, not a field, in String. The above is just a minimal example. I am experiencing this issue in just about all deftype that I need to type-hint. The error when type-hinting suggests that the latter is unnecessary, that it could be deduced from the hints in the protocol definition--but that is not the case. What am I missing? Thanks for any help. Albert -- http://albert.rierol.net -- 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