Fork me on GitHub
#clojurescript
<
2016-10-09
>
nathansmutz06:10:03

This is the output of a pr-str form. Invoking cljs.reader/read-string on it gives an error "Map literal must contain an even number of forms". Even feeding one directly into the other, (cljs.reader/read-string (pr-str @the-thing)) gives this error. I can't see what's causing the error:

nathansmutz06:10:07

{:client {:Wall Mart {:client-email "<mailto:[email protected]|[email protected]>"}, :k-Mart {:client-email "<mailto:[email protected]|[email protected]>"}}, :item {:123 {:item-name "wodget", :client "Wall Mart", :charge 10.5}, :789 {:client "k-Mart", :charge 20.45, :item-name "blaster"}, :456 {:item-name "wodget", :client "Wall Mart", :charge 10.5}}}

rarous07:10:02

@nathansmutz :Wall Mart <- there is a space in the keyword

pesterhazy08:10:18

Unfortunately prn can produce output that cannot be read

rarous09:10:27

The problem is data inconsistency in model. Keys in :client map should be strings, so you can easily access them from items without conversion to keyword

rarous10:10:07

The prn-str problem is just a smell

nathansmutz14:10:19

Woh, thanks @rarous. I didn't spot that. Now to figure out where "Wall Mart" got turned into a keyword.. and how my app didn't break because of it.

nathansmutz14:10:04

Ah, it was a workaround. I'm using the plato library to put that atom in persistent storage. It only supports keyword keys.

moxaj19:10:15

I've run into a strange issue: declaring a var :const results in a warning "Can't redefine a constant ..." from the compiler. I'm pretty sure it isn't declared anywhere else (even tried giving it a random name). It's in a .cljc file. Maybe someone's met this before?

moxaj19:10:51

Also, it only seems to happen where the namespace which declares the constant is required by at least 2 other namespaces. This is probably a hint to those who are familiar with the compilation process.

anmonteiro19:10:01

@moxaj you probably want to defonce that var

moxaj19:10:13

@anmonteiro works! but it's still a bug, isn't it?

anmonteiro19:10:00

@moxaj if you’re requiring the file twice, the def is probably being evaluated twice.

anmonteiro19:10:11

but I can’t confirm that’s what’s actually happening

moxaj19:10:20

@anmonteiro probably, but still seems unintuitive to me

moxaj19:10:26

@anmonteiro defonce solved my dummy case, but not the actual one. sad

anmonteiro19:10:21

@moxaj maybe an actual bug

anmonteiro19:10:33

if you can make a minimal repro, file a bug in ClojureScript’s JIRA

dm321:10:11

There's a WeakMap polyfill in Google Closure Compiler - how does one use it? I understood you can inject polyfills using --inject_library=es6_runtime when invoking the GCC explicitly but Clojurescript doesn't seem to support that. Should I just include the shim as a foreign library?

mfikes21:10:28

@moxaj It would be interesting to see what you get if you macroexpand the quoted form of your defn.

mfikes21:10:04

@moxaj Are you compiling with :parallel true?

moxaj21:10:54

@mfikes the macroexpanded code looks alright to me, I can paste it if you'd like to

moxaj21:10:14

@mfikes it uses the same symbol

mfikes21:10:27

Nah, that’s OK it looks OK to me as well. I’d suggest turning off :parallel to see if it goes away.

mfikes21:10:58

This is the option I meant to refer to :parallel-build: http://clojurescript.org/reference/compiler-options#parallel-build

moxaj22:10:47

@mfikes 3 builds in a row with no error!

moxaj22:10:45

@mfikes also, if you scroll up a little, I had another issue where the compiler thought I was redefining constants - I tried with parallel-build off and it works

mfikes22:10:35

@moxaj Perhaps you’ve discovered two separate bugs related to :parallel-build. If so, perhaps it will be possible to construct a minimal repro for a ticket.

moxaj22:10:47

@mfikes is it acceptable to create a ticket and submit a minimal repro later?

mfikes22:10:10

@moxaj I’d personally lean towards holding off on creating a ticket until a minimal repro exists

mfikes22:10:57

But to answer your question, I don’t know what the rules are beyond what is documented here http://clojurescript.org/community/reporting-issues

dnolen23:10:16

@moxaj reporting an issue without a minimal repro for :parallel-build isn’t useful

moxaj23:10:05

@dnolen I've already given up trying to create one 😞

dnolen23:10:22

no worries, if there’s a bug someone else will inevitably find it

moxaj23:10:45

if it is indeed a race condition, I don't know how to trigger it