12

Can anyone tell me why is it good to use some crap language that transpiles to javascript? Yes i hate js too but 90% of my time using reason/ts/elm is just

>ddg how to do x in y
>no answer
>Js.unsafe.eval "js code"

Like???? None of them is a 100% complete wrapper???

Comments
  • 1
    the advantage of elm is that the transpiler is friendly, helpful and doesn't allow bugs. It is imutable out of the box. But yeah in the end it's html css js.
  • 5
    One issue with JS is type bugs, especially after refactoring. You never really know what "this" shit is, and you will only find out at runtime. Or you just made a typo, so a new variable is instantiated, but no error message. Happy debugging and wasting time.

    That sucks, so people want to have a typed language where such bugs are detected statically and automatically - by the compiler.

    But how would you execute the result? Java promised "write once, run everywhere", but due to various historical reasons, it is JS that actually keeps this promise. So you transpile that to JS and can execute it in any browser while still enjoying a less sick language for development.
  • 3
    @heyheni yeah, fair point, the transpiler warnings are useful
  • 5
    JavaScript is valid TypeScript. TypeScript is a superior supersets of JavaScript. If written consistently, the transpiler prevents bug before you run them. The older I get and the more I program, the more I want type safety.

    TypeScript is not perfect, as in the end is still produces JavaScript, yet it also targets different version of JavaScript (you can create code that runs in almost every browser, or make use of the most modern version), yet it saved my sanity more than once.
  • 2
    A lot of the "problems' with JavaScript actually come down to developer discipline. As a general statement, there's a dangerous lack of developers having good habits and having the drive to make code as solid as possible (or the skills to do so in some cases, but that I think may be less of a problem than it sometimes seems). There's other factors at play of course - tight deadlines and ridiculous requirements not allowing developers time and focus to do their jobs right, just to name a few - but a lot of it is simply laziness and lack of good habits. That's not intended to exonerate JS itself entirely, but I think we'd be having a very different conversation and view of JS generally if we had developers doing the right things more than they generally do now. We wouldn't be looking for tools (like TypeScript, which is a tool in a sense) to gloss over problems as much as the industry as a whole does right now if we had more disciplined developers as a rule.
  • 0
    I personally like just using ES5 but that's not for everyone considering some companies still want to support Internet Explorer
Add Comment