Meikel, Strong type systems make programming in the large easier. It would be nice if I didn't have to walk on eggshells when using a library. Written agreements are also known as "gotchas".
-- Paul Hobbs On Wed, Nov 3, 2010 at 11:30 PM, Meikel Brandmeyer <m...@kotka.de> wrote: > Hi, > > On 4 Nov., 04:58, ka <sancha...@gmail.com> wrote: > > > (defprotocol OnlyHalfCooless x y z) > > > > Instead of > > (defn is-this-cool? [o] (satisfies? Coolness o)) > > > > I need to now write: > > (defn is-this-cool? [o] (or (instance? Cool1 o) (instance? Cool2 o)) > > or, (even worse) > > (defn is-this-cool? [o] (and (satisfies? OnlyHalfCoolness o) > > (instance? Comparable o) (instance? Serializable o)) > > May I ask a heretic question: Why don't you specify the contract in > the docstring of the protocol? > > (defprotocol Coolness > "Yadddayaddablablablubber. > Cool things have to be Comparable and Serializable." > (x ..) > (y ...)) > > If someone doesn't adhere to this contract, it's his program which is > broken, not yours. > > Sincerely > Meikel > > -- > 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<clojure%2bunsubscr...@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 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