5 ms·
> 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 w
by 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.