> > > 1. Types are useful for structures that HOLD data (ints, strings, > > maps, arrays… ) because they provide ways defining standard > > operations to manipulate data that make sense in the context of > > that type of data. It is helpful to have a type checker check > > that I am not accessing the 6th element of a hashmap or that I am > > adding 10 to "Hello". > > This would be useful indeed. Although, a hard core type head would say > "I want to distinguish between a string that is an email, someones name, > and a day of the week". This is not unreasonable. > > Perhaps some may see this as an oversimplification, but ...
If you try and add 10 to "Hello" in a typed language, you get an error. If you try to do the same in a dynamic language, you get an error. The only difference seems to be that in a dynamic language, you need to *run* the code to get the error, rather than compile it. That said, not all programming errors in a typed language will be found at compile time, so these need to be run anyway to test them. As I understand it, in a dynamic language, if you want to check if a string is an email, you need some function like defn (email? [str]). You'd need the same in a typed language. I've never understood the essential distinction here. (+ 10 "Hello") doesn't work in both dynamic or typed languages because, well, 10 and "Hello" are different *types* of things. Both dynamic and typed languages interpret them as different types. I do understand, however, that typed languages are more difficult to learn and program in, and that the same task can take longer in a typed language. It also seems to me that it is easier to lose the forest for the trees in a typed language. When we speak with each other, we don't generally say "The number 6 plus the number 4 equals the number 10." There's a good reason for that. "6 plus 4 equals 10" is not only sufficient, but easier to understand. The incidental complexity that type systems add *can* foster programming errors, even as typed languages are supposed to prevent them. -- -- 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 --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.