3 ms·
So why not just use JavaScript to begin with?
by roundpizza 12y ago
So why not just use JavaScript to begin with?
- PaulRobinson 12y agoBecause Javascript is a horrible language to code in and debug. If you're a Ruby programmer, you don't need to learn a new language, and you can have confidence that the Opal guys have looked after a lot of the issues you're not experienced enough to understand. Your question is like asking a C programmer "why not just use assembler?" or an assembly programmer "why not just toggle 1s and 0s in, because ultimately your code is going to get turned into binary eventually, right?" Abstractions and different models of describing a problem solutions are helpful for a multitude of reasons.
- eyko 12y agoIt has been my experience that JavaScript is a high level language. In this particular case, Ruby is not being compiled to JavaScript but being transpired.
- LBarret 12y agoit's a mix, some stuff is high level (closure), some is low level (for loop before ECMA6). This is very uncomfortable when you're learning it, you never know on which side you are.
- dragonwriter 12y ago> In this particular case, Ruby is not being compiled to JavaScript but being transpired. First, "transpiled" not "transpired". Second, "transpiled" is a special case of "compiled", so you can never correctly say that something is not being compiled but is being transpiled, in the same way you can't say something is not a rectangle but is a square.
- philwelch 12y agoWhile JavaScript is a terrible language to debug, machine-generated JavaScript is little better, and leaves you guessing which code you need to change and how in order to affect it.
- mercurial 12y agoIt can be better if it is compiled from a strongly-typed language. This gives benefits you'll never get from raw Javascript.