Welcome! Please see the About page for a little more info on how this works.

0 votes
in ClojureScript by

Defrecord produces code that's incompatible with ECMASCRIPT3 language:

(defrecord Query [with in])

`
Compiling "target/main.js" from ["src"]...
Jul 14, 2017 6:58:14 PM com.google.javascript.jscomp.LoggerErrorManager println
WARNING: /Users/prokopov/work/cljs-test/target/cljsbuild-compiler-0/cljs_test/core.js:117: WARNING - Keywords and reserved words are not allowed as unquoted property names in older versions of JavaScript. If you are targeting newer versions of JavaScript, set the appropriate language_in option.
return (!((other13203 == null))) && ((this13202$1.constructor === other13203.constructor)) && (cljs.core.EQ.cljs$core$IFn$_invoke$arity$2(this13202__$1.with,other13203.with)) && (cljs.core.EQ.cljs$core$IFn$_invoke$arity$2(this13202$1.in,other13203.in)) && (cljs.core.EQ.cljs$core$IFn$_invoke$arity$2(this13202$1.extmap,other13203.__extmap));

                                                                                                                                                        ^

Jul 14, 2017 6:58:14 PM com.google.javascript.jscomp.LoggerErrorManager println
WARNING: /Users/prokopov/work/cljs-test/target/cljsbuild-compiler-0/cljs_test/core.js:117: WARNING - Keywords and reserved words are not allowed as unquoted property names in older versions of JavaScript. If you are targeting newer versions of JavaScript, set the appropriate language_in option.
return (!((other13203 == null))) && ((this13202$1.constructor === other13203.constructor)) && (cljs.core.EQ.cljs$core$IFn$_invoke$arity$2(this13202__$1.with,other13203.with)) && (cljs.core.EQ.cljs$core$IFn$_invoke$arity$2(this13202$1.in,other13203.in)) && (cljs.core.EQ.cljs$core$IFn$_invoke$arity$2(this13202$1.extmap,other13203.__extmap));

                                                                                                                                                                        ^

Jul 14, 2017 6:58:14 PM com.google.javascript.jscomp.LoggerErrorManager println
WARNING: /Users/prokopov/work/cljs-test/target/cljsbuild-compiler-0/cljs_test/core.js:117: WARNING - Keywords and reserved words are not allowed as unquoted property names in older versions of JavaScript. If you are targeting newer versions of JavaScript, set the appropriate language_in option.
return (!((other13203 == null))) && ((this13202$1.constructor === other13203.constructor)) && (cljs.core.EQ.cljs$core$IFn$_invoke$arity$2(this13202__$1.with,other13203.with)) && (cljs.core.EQ.cljs$core$IFn$_invoke$arity$2(this13202$1.in,other13203.in)) && (cljs.core.EQ.cljs$core$IFn$_invoke$arity$2(this13202$1.extmap,other13203.__extmap));

                                                                                                                                                                                                                                              ^

Jul 14, 2017 6:58:14 PM com.google.javascript.jscomp.LoggerErrorManager println
WARNING: /Users/prokopov/work/cljs-test/target/cljsbuild-compiler-0/cljs_test/core.js:117: WARNING - Keywords and reserved words are not allowed as unquoted property names in older versions of JavaScript. If you are targeting newer versions of JavaScript, set the appropriate language_in option.
return (!((other13203 == null))) && ((this13202$1.constructor === other13203.constructor)) && (cljs.core.EQ.cljs$core$IFn$_invoke$arity$2(this13202__$1.with,other13203.with)) && (cljs.core.EQ.cljs$core$IFn$_invoke$arity$2(this13202$1.in,other13203.in)) && (cljs.core.EQ.cljs$core$IFn$_invoke$arity$2(this13202$1.extmap,other13203.__extmap));

                                                                                                                                                                                                                                                           ^

Jul 14, 2017 6:58:14 PM com.google.javascript.jscomp.LoggerErrorManager printSummary
WARNING: 0 error(s), 4 warning(s)
Successfully compiled "target/main.js" in 6.224 seconds.
`

Probably there should be some name escaping happening? I see that {{(defn with [])}} is compiled as {{cljs-test.core.with$}}. Should we do the same for records?

3 Answers

0 votes
by

Comment made by: dnolen

Now that CLJS-1620 is done, we should think about this more deeply.

0 votes
by

Comment made by: grncdr

Ran into an interesting bug that is likely a consequence of this:

cljs.user=> (defrecord T [arguments]) cljs.user/T cljs.user=> (= (T. [1]) (T. [0])) true

0 votes
by
Reference: https://clojure.atlassian.net/browse/CLJS-2236 (reported by tonsky)
...