> Type hints don't reduce flexibility AT ALL.
>
> user=> (defn t1 [x] (.length x))
> #'user/t1
> user=> (t1 "foo")
> 3
> user=> (t1 'foo)
> #<CompilerException java.lang.IllegalArgumentException: No matching
> field found: length for class clojure.lang.Symbol
> (NO_SOURCE_FILE:141)>
>
> Since it calls a String method it doesn't work if you call it with a 
> non-String.

It prevents duck-typing: t1 works on any object having a length method.
t2 only works on String.

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