Fork me on GitHub
#clojure-dev
<
2015-07-16
>
Alex Miller (Clojure team)14:07:06

I don't have time to look at this atm but someone go make sense of that!

clojuregeek14:07:11

that is weird..

Alex Miller (Clojure team)14:07:04

most likely my fault as I was the last one to touch the destructuring code :)

devn14:07:51

so, was that the case in 1.6 or no?

Alex Miller (Clojure team)14:07:32

(correctly) threw an exception in 1.5

Alex Miller (Clojure team)14:07:13

I would strongly suspect http://dev.clojure.org/jira/browse/CLJ-1318 in 1.6 as where it changed

clojuregeek14:07:17

correctly throws with either [y] 1 .. or y [1] … not [y] [1]

ragge14:07:57

yeah, destructure drops ns

ragge14:07:09

user> (destructure '[a/x 42])
[a/x 42]
user> (destructure '[a/x 42 [y] [1]])
[x 42 vec__7738 [1] y (clojure.core/nth vec__7738 0 nil)]

Alex Miller (Clojure team)14:07:57

that's intentional (in maps) but doesn't make sense here in positional. that code is tricky.

ragge14:07:04

first time I'm looking at destructuring code, i like it simple_smile

devn14:07:38

heh, yes -- tricky.

clojuregeek14:07:46

this throws exception (let [a/x 42, [y] {:val 1}] x) ` as does if its a set

ragge14:07:34

it looks like this line is quite wrong as, from what I can tell, it will always drop the namespace of a namespaced symbol: https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L4289

ragge14:07:04

it will only be hit if there is some actual destructuring going on though, that's why it's still working in the simple case (let [a/x 42] x)

ragge15:07:05

i guess nothing keeps track of whether the symbol in question was used in a map destructuring or not

bronsa15:07:25

don't know if that'll be easy to fix, that same path is used to make (let [{:keys [foo/bar]} {:foo/bar 1}] bar) work IUC

ghadi15:07:43

gotta love a language whose bug reports come in tweets

bronsa15:07:10

http://sprunge.us/jAgS?diff does it, too much of a hack?

ragge15:07:41

@bronsa: will that solve (let [[a/x] [1]] x)?

bronsa15:07:51

probably not

ragge15:07:01

yeah, no... still calling pb for vector

bronsa15:07:48

ah, (let [[:foo] [1]] foo) works too

ragge16:07:57

moves removal of ns and keyword support to a special case in pmap instead

ragge16:07:01

mvn test passes

ragge16:07:08

@alexmiller: added my patch to ticket... should I include a test case demonstrating the regression too?

Alex Miller (Clojure team)16:07:16

there are some destructuring tests at test/clojure/test_clojure/special.clj

ragge16:07:42

dinner time for daughter now, will have a look at that later

Alex Miller (Clojure team)19:07:39

clojure jira system likely going down for a little bit today to increase memory on process and box, hopefully to stabilize it for a while

Alex Miller (Clojure team)19:07:10

this is a stop-gap till we have time to do more significant updates to that infrastructure