On Wednesday, March 20, 2013 4:34:32 PM UTC+1, James Reeves wrote: > On 20 March 2013 08:36, Marko Topolnik <marko.t...@gmail.com <javascript:> > > wrote: > >> If you responsibly keep to the "good parts", exceptions could be the way >> to go. Validation is one example where I love them because it happens all >> around, but validation failures are all handled uniformly. >> > > If validation happens "all around", that implies there is no one function > that can test whether a value of data is valid for a given data store. This > strikes me as a somewhat shaky foundation for a system. >
The idea is that all validation functions share the same contract to call the appropriate *add-failure* function that registers the validation result. > There may be instances where it makes sense to use exceptions as a control > flow mechanism, but I wonder whether it wouldn't be better to use something > like CPS in those instances. > I can't picture how such a mechanism would work, and what benefit it would bring over the exceptions mechanism. CPS in Clojure means trampolining, which is quite an unwieldy, and I'd say "cheap" tack-on. A validating function would then be supposed to return a common, globally-defined "continuation", in fact just a simple function, that would redirect the flow towards the validation failure-handling case. -marko -- -- 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.