On Fri, Oct 21, 2011 at 11:50 AM, Mark Engelberg
<mark.engelb...@gmail.com> wrote:
> I've always felt that Clojure's treatment of nil was somehow inconsistent
> with the elegance of many other features of Clojure.  Now I can finally
> articulate why:  nil complects non-existence, false, and empty.
>
> The choice to make nil represent so many concepts was an "easy" choice,
> because it saves a few characters when you can write things like (when seq
> ....) vs. (when (empty? seq) ...) and Clojure implements sequences in a way
> that the former expression is also a bit more performant.  It is also easy
> in the sense that it is more similar to what Lisp users (as opposed to
> Scheme) are used to from past experience.  But it is decidedly less simple
> to have these ideas complected.
> Over the past couple of years, I've seen numerous bugs along the lines of
> "Your function usually works great, but it breaks when the list/map/vector
> you pass in contains nil values."  It seems clear to me that nil's
> complexity makes programs harder to analyze, because when you're writing
> your code, you might be thinking of nil as only representing non-existence
> or emptiness, for example, and forgetting that the system will treat nil as
> a false value as well.

Yes:  Was that a nil value for the key :foo in my map or did :foo not
exist?  In Common Lisp, some such functions return multiple values,
de-multiplexing (deplecting?) the separate meanings of nil.  Then, of
course, you need a multiple-values-bind special form to handle those
return values.  Braids begetting braids.

Curious, this, when Clojure already says (not (= nil ())).

Mike

-- 
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

Reply via email to