2009/11/9 Tiago Antão <tiagoan...@gmail.com>: > What is the rationale for even? and contains? having different > behaviors for the exact same error (ie, one throws the other works > fine and just returns false on a type error)? From a design > perspective this seems to increase the cognitive load to programmers > without any (apparent) reason. >
I imagine the rationale is efficiency. Every core function could conceivably do a number of runtime checks to make sure that each input is the right kind of type, and then Clojure might feel more sluggish. So instead, the core functions just worry about what to do for the appropriate inputs. If you pass a bogus input, the consequence depends entirely on how that particular function was coded. It might return a spurious result, or it might error. There are numerous examples of this in the Clojure API. It wouldn't surprise me if there are a number of programmers who would be turned off by the ease with which one can shoot yourself in the foot without getting any kind of error message, but in practice I haven't gotten bit by this yet. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---