Sunday, 15 January 2012

clojure - is it possible to have type hints without LET? -



clojure - is it possible to have type hints without LET? -

this code (an example):

(def foo (.java_method java_object)) (debug "result of method bar() on object foo: " (.bar foo))

i warning (foo of type footype in java):

reflection warning, example/test.clj:2 - phone call bar can't resolved

i can remove warning type hint:

(def foo (.java_method java_object)) (debug "result of method bar() on object foo: " (.bar ^footype foo))

this works, have type hinting every time utilize foo. solution utilize let, creates indentation level, i'd avoid. possible like?:

(def foo (.java_method java_object)) (set-type foo footype) (debug "result of method bar() on object foo: " (.bar foo))

no. associating compile-time metadata type-hints named values, utilize let.

clojure

No comments:

Post a Comment