squint-cljs / cherry

Experimental ClojureScript to ES6 module compiler
https://squint-cljs.github.io/cherry
553 stars 22 forks source link

= is throwing an "_EQ_ not defined" error at runtime #79

Closed alexdao3 closed 1 year ago

alexdao3 commented 1 year ago
$ ./node_cli.js -e '(= 1 2)'
file:///Users/borkdude/dev/cherry/.tmpQ1aZ4r/cherry.mjs:1
_EQ_.call(null, 1, 2);
^
borkdude commented 1 year ago

This is an advanced compilation bug with shadow-cljs. cc @thheller

borkdude commented 1 year ago

In more detail:

Shadow-cljs optimizes symbol constants like this. If you have '= then shadow-cljs writes:

cljs$cst$_EQ_ = new Symbol(..., "=")

But when you write '_EQ_ it also writes:

cljs$cst$_EQ_ = new Symbol(..., "_EQ_")

hence the conflict. In cherry we have both the '= and '_EQ_ symbols as compile time constants.