On Mon, Oct 10, 2011 at 12:08 PM, Daniel Pittman <dan...@rimspace.net>wrote:
> On Mon, Oct 10, 2011 at 06:57, David Nolen <dnolen.li...@gmail.com> wrote: > > On Sun, Oct 9, 2011 at 11:19 PM, Ambrose Bonnaire-Sergeant < > abonnaireserge...@gmail.com> wrote: > >> On Mon, Oct 10, 2011 at 3:31 AM, David Nolen <dnolen.li...@gmail.com> > wrote: > >>> > >>> - return nil instead of throwing if no match found to mirror the > behavior > >>> of cond > >> > >> I don't like this. > > > > I'm definitely open to talking about it. Strong opinions appreciated :) > > > >> Why are we emulating cond? clojure.core/case, for example, seems closer > to > >> what `match` provides, > >> and that throws an IllegalArgumentException if there is no match. > >> Seems arbitrary to me. > >> Is there more to it? > > > > A good point. I'm mostly thinking about user friendliness here. I'm also > OK > > w/ the idea of providing two versions of match - one w/ verbose error > > reporting that throws and perhaps the default one that doesn't > > So, I have one other argument in favour of "just return nil", which I > prefer: > > If you just return `nil`, I can use :else to throw fairly cheaply, and > quite visibly. > > If you throw then I have to wrap any non-exhaustive pattern in a > try/catch block to avoid the exception propagating up the stack. > > Daniel > We'll only throw w/ match-debug. David -- 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