Dissoc behaviour on records really surprised me:

    user> (defrecord Foo [bar])
    ;; => user.Foo
    user> (def foo (->Foo nil))
    ;; => #'user/foo
    user> (dissoc foo :bar)
    ;; => {}
    user> (assoc foo :bar nil)
    ;; => #user.Foo{:bar nil}

It lead to a bug where a component of mine, which I was using to
dispatch in a multimethod was replaced with an empty map:

https://github.com/stig/accounts/commit/f4124b69cfc9fdc201b29f97e33a5b7bd6279e7f

*toy project alert*

As an aside, I'm now starting to understand why all the components
examples use `assoc foo :bar nil` rather than dissoc...

Stig

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