Hi Dave, it _isn't_ an Illegal argument though :-), your destructuring
is simply ignoring that parameter.

However, I get the pain and solutions might be (in order of 'heavyness'):
 - http://blog.fogus.me/2009/12/21/clojures-pre-and-post/
 - https://github.com/Prismatic/schema
 - http://typedclojure.org/

HTH

Dave Tenny writes:

> I sure wish Clojure would generate "IllegalArgumentException" in the
> following sample case:
>
> (defn foo [a b & {:keys [c d]}] 1)
> (foo 1 2 :e 5) ; blithely ignores :e 5
>
> I understand that Clojure's destructuring things are very nice, and more
> powerful than Common Lisp's, and I like
> that when I need it.
>
> However I can't tell you how many times I've been bitten by this. Some
> simple typo or other other parameter name error on keyword arguments
> with untended and way-too-long-to-debug consequences.
>
> In my mind, on this subject, Common Lisp lambda lists got this right and
> Clojure gets a poor grade.
> Something about being doomed to repeat history.  In Common Lisp, if you
> really wanted to allow other (arbitrary) keywords you'd
> just use &allow-other-keys.
>
> Maybe clojure should only allow the above case to go un-complained-about if
> :as was specified for the map.
>
> If there's some automatic enforcement I'm missing that comes with 'defn'
> please let me know, I'm still learning the language.
>
> I've thought more that once about making a common lisp DEFUN statement that
> maps to DEFN but implements
> lambda list semantics (including 'supplied-p' parameters).  I've just been
> too lazy to do it.
>
> It would also likely perform poorly after injecting the additional
> checks/rearrangements into the function on top of what Clojure has already
> done,
> so I suppose it would have to be taken a step further so that it didn't
> generate DEFN expressions at all but was implemented at DEFN's level as
> a seperately named form.
>
> Tips welcome.  Just thinking aloud.
>
> - Dave

--
Sent with my mu4e

-- 
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/d/optout.

Reply via email to