News for hackers. Stuff that matters.
Re:Try Clojure by camelspotter on Thursday May 23, 2024 @05:59AM (#40452715)
this example shows how "elegant" closure treats syntax errors, almost looks like a bad joke.

=> (+ 2 2 + 3)

"4function Cg(a){switch(arguments.length){case 0:return Cg.s();case 1:return Cg.g(arguments[0]);case 2:return Cg.h(arguments[0],arguments[1]);default:for(var c=[],d=arguments.length,e=0;;)if(e<d)c.push(arguments[e]),e+=1;else break;return Cg.j(arguments[0],arguments[1],new gc(c.slice(2),0,null))}}3"

Re:Try Clojure by zakkor1 on Thursday May 23, 2024 @06:07AM (#40452766)
That's a bug in the JS interpreter they're running, not anything related to Clojure. Also, that's not a syntax error
Re:Try Clojure by silcoon on Thursday May 23, 2024 @06:14AM (#40452809)
Not a syntax error. TryClojure is running on SCI which is a interpreter that uses a Babashka version for Clojurescript compiler, not Clojure JVM.

Babashka cli returns this, telling you clearly what the error is:

   user=> (+ 2 2 + 3)
   java.lang.ClassCastException: clojure.core$_PLUS_ cannot be cast to java.lang.Number [at <repl>:1:1]