4 ms·
Genuine question: does transpiling from Go, for example, make things any better? I've often wondered if I'd be doing my self any favors or just making things wo
by movedx 9y ago
Genuine question: does transpiling from Go, for example, make things any better? I've often wondered if I'd be doing my self any favors or just making things worse if I opted for that path. My goal would be to avoid even looking at JS at all whilst still being able to develop for the front end.
Thoughts?
Edit: no idea why you're being down voted. Perhaps you hurt the feelings of some JS developers? ;-)
- baybal2 9y ago>Genuine question: does transpiling from Go, for example, make things any better? No, transpiled code is bad. Moreover, I see close to no point in transpilation of a code made to run in browser from an another language. Instead of writing an in-browser app in Go, and then spending an amount of time equal to writing the original code fixing bugs brought by transpilation, why not to just write the thing in Javascript from the start? JS is not a complicated language. >Transpiling isn't complicated or magic, you can get any C compiler to "transpile" your code into assembly and then compile that without any issues (same for C-LLVM "transpiling"). C is a very simple language. For a language/tool intentionally made to align with target's capability. Reliability is not that hard to achieve. An example of that is Vala. The more feature rich languages you have on both side of the transpilation, the more you loose in comparison to the native code. >Edit: no idea why you're being down voted. Perhaps you hurt the feelings of some JS developers? ;-) I am a JS developer. But before, I tried myself at C, C with glib, electronics engineering, and other, more normal, languages. I worked in tech since 2007, and it was only after 2013 the job market steered me completely into webdev. My rants at JS are exactly because I saw the language from a side, see its deficiencies, and have a clear idea to what to compare it to.
- zaarn 9y ago>No, transpiled code is bad Not my experience. While GopherJS ( a Go-JS Transpiler ) has it's warts ( blocking activity in callbacks, filesize ) none of them is "the transpiled code is more buggy than it should be". The code that GopherJS produces is in my experience very reliable and errs on the side of being slow rather than incorrect. Transpiling isn't complicated or magic, you can get any C compiler to "transpile" your code into assembly and then compile that without any issues (same for C-LLVM "transpiling"). It also means we get that "sweet" "run same code in client and server" feature that Node.js always rave about.
- guitarbill 9y ago> No, transpiled code is bad. Moreover, I see close to no point in transpilation of a code made to run in browser from an another language. Instead of writing an in-browser app in Go, and then spending an amount of time equal to writing the original code fixing bugs brought by transpilation, why not to just write the thing in Javascript from the start? Transpiled code is not inherently bad. Transpiling is still compilation, we just give it a different name to distinguish "high-level" to "high-level" compilation from the more usual "high-level" to "low-level" compilation (whatever high/low-level exactly means). Compilers exist to support nicer/more high-level syntax on a common platform, Babel is no different than Java, GCC or LLVM in this regard. A nice side-effect of compilation is certain checks for correctness, and compile-time checks don't get magically erased because you're transpiling to a different high-level language. Note that when he says "write the thing in Javascript from the start", that's not giving all the facts. Javascript now has several versions, how do you target older ones, or if you're using older ones, how do you take advantage of newer concepts? You'll either be using a load of shims, or probably transpiling Javascript. Babel is pretty sane as far as the Javascript ecosystem goes, and has some great upsides. IMO it's better to use Babel so you get to use the newer ECMAScript features (which is future-proof for when browser adoption progresses), instead of infesting your codebase with cancerous "helper" libraries like underscore that are painful to remove or replace with modern ECMAScript equivalents. So, if transpiling helps you write more maintainable code, don't be put off by this. Assembly isn't that practical, neither is really old Javascript.