5 ms·
I'm skeptical of any x-to-JS compiler as usually I end up debugging 2 different codes, where the second one is machine generated. After that you try to work aro
by CCs 12y ago
I'm skeptical of any x-to-JS compiler as usually I end up debugging 2 different codes, where the second one is machine generated. After that you try to work around on the first to make the generated one do what you want.
On the other hand the Scala people know how to write compilers. We're live, in production, with Scala since 2011 and it's a joy: it actually delivers what's promised. Heard the same thing from Twitter, LinkedIn and Netflix too.
So maybe it worth a try; especially if it will integrate with ReactJs / React Native. Sounds like a match made in heaven.
- wtetzner 12y agoYeah, you could maybe even get the JSX-style syntax with React by using Scala's XML support. I'm not sure if it would actually work, but it's a cool idea.
- danellis 12y agoIf you mean XML literals, they're deprecated now. I don't know whether the macroized XML interpolator has landed yet.
- codygman 12y ago> debugging 2 different codes, where the second one is machine generated. After that you try to work around on the first to make the generated one do what you want. Please forgive me for the accusation, but I've heard many people say this same statement to later found out they just meant "Well it's never happened to me... but it could... but it happened to this person I know...". I personally can't think of many situations where you'd debug the machine generated javascript instead of using a sourcemap, can you give more detail on your experience?
- reverius42 12y agoTo me this sounds like the same argument against C compilers: "You'll just end up debugging the generated asm anyway!". Turns out (mature) compilers are generally better at writing code than humans, and most of the time you don't have to debug their code, only your own. Almost every time I've heard someone say "I found a bug in the compiler!", they didn't.
- comex 12y agoDepends if you're trying to debug optimized code or not... sometimes I try to do that since I'm too impatient to recompile something at -O0. Sometimes it works, sometimes I end up wasting more time than the recompilation would have taken.
- JanneVee 12y agoI've found 3 compiler bugs during my 15 years as professional developer. One was a optimizer bug sprintf in a for loop reset the ecx register so the loop became infinite and the last two where valid code that crashed the compiler (how do I know that, because the crashes dissappeared with small modifications of the code, like newlines). But yeah they are pretty rare.
- BurningFrog 12y agoAt least for CoffeeScript, the generated code is so close to the the original source that the mapping is obvious. I've never needed to get the source map working.
- skatenerd 12y agoI've had this happen with Clojurescript. If I recall correctly, runtime errors refer to the generated code, rather than to the source. So it can be hard to diagnose what exactly is going wrong. This may have changed since I was last working with Clojurescript.
- CCs 12y agoThere's a difference between a lightweight transpiler like JSX and a compiler. ClojureScript is pretty lightweight, but GWT and Scala.js compile process is not an easy one. Even Bootstrap.js optimization with Google Closure Compiler is an uphill battle. Try it with --compilation_level ADVANCED_OPTIMIZATIONS Sourcemap does not help much with compiler bugs or if the compiler people have different opinion from you on how something should be translated.
- ddellacosta 12y agoI'm skeptical of any x-to-JS compiler as usually I end up debugging 2 different codes, where the second one is machine generated. After that you try to work around on the first to make the generated one do what you want. I can't speak to any other x-to-JS transpiler but I've been writing ClojureScript almost every day for close to two years and this has never been an issue. At the very least this has to be dependent on which 'x' we're talking about.