This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-08-12
Channels
- # bangalore-clj (4)
- # beginners (40)
- # boot (53)
- # cider (34)
- # cljs-dev (9)
- # cljsrn (11)
- # clojure (113)
- # clojure-boston (5)
- # clojure-dev (9)
- # clojure-dusseldorf (4)
- # clojure-russia (8)
- # clojure-spec (11)
- # clojure-uk (12)
- # clojurescript (88)
- # cloverage (17)
- # conf-proposals (4)
- # core-async (30)
- # cursive (9)
- # datomic (107)
- # euroclojure (5)
- # hoplon (196)
- # luminus (10)
- # off-topic (20)
- # om (24)
- # om-next (1)
- # onyx (80)
- # parinfer (3)
- # pedestal (16)
- # planck (44)
- # proton (8)
- # protorepl (1)
- # re-frame (19)
- # reagent (7)
- # spacemacs (2)
- # untangled (29)
- # yada (25)
Is this a bug or just an "expected weirdness"
boot.user=> (let [{:foo/keys [a b] :bar/keys [a b c] :as all} #:foo{:a 1 :b 2 :c 3 :bar/a 4 :bar/c 5 :d 6 :bar/e 7}] [a b c all])
[4 nil 5 {:foo/a 1, :foo/b 2, :foo/c 3, :bar/a 4, :bar/c 5, :foo/d 6, :bar/e 7}]
boot.user=>
My initial thought was that this should throw an exception as a
and b
are duplicated in the destructuring...
…since it doesn’t, I’ll assume either "undefined behavior" or "last declaration wins" (but likely the the former since maps are inherently unordered).
and that destructuring is not expressable in the desugared destructuring form, because it is a map
So… undefined behavior… that just isn’t detected (and flagged) by the compiler?
yeah, we talked about this when implementing and decided that if you do this, what happens is undefined, so don’t do that
you’re asking for something that has no meaningful result
Yeah, I’m happy with either an exception (if detecting it had zero cost) or undefined behavior. It’s an obvious "shouldn’t work" situation as far as I was concerned.