User Controls

Languages that compile to javascript

  1. #1
    Lanny Bird of Courage
    Anyone here ever written web code in a language that uses javascript as a compile target? Do you have a favorite? Is it always best to just work in JS? What did you think about what you tried? For me:

    Coffee Script: I like python so I actually like no braces and significant whitespace but I feel like the only benefit you get out of coffee script is marginally better syntax and the headaches of source mapping, even with modern tooling, just don't justify it to me. The object-literal syntax is pretty questionable in my mind and while I'll grudgingly admit I prefer classical inheritance it's not that hard to work around in vanilla JS and considering it's just not feasible to use coffeescript and never have to dive into actual JS I feel that it's not a significant benefit to anyone.

    Clojurescript: I love clojure and clojurescript is a great idea. It's a total joy to write. Issues arise in 1. the heavy weight setup process and considerable ceremony every project requires and 2. the weight of the runtime is something that weighs heavy on my conscious. It's a perfect system for a large industry-strength application but for one-offs or small projects it's often hard to justify the massive support machinery that's required for a cljs project.

    Typescript: I've never actually used it but the idea is cool. I expect the implementation is shit since it came from MS but I shouldn't judge until I try. I'm actually not a huge fan of static typing but I've suffered greatly and many times over the wild-west "anything goes" policy in vanilla JS and I've had a good number of problems that never would have happened with type checking. I think the world is still ripe for popular/good implementation of gradual typing and when it arrives we'll realize it's just the right thing in much the way we came to understand high level languages are the right thing, but until then if I can have a typechecker blow up in the face of the nigger who's trying to pass a square argument into a circular function I'll count it as a win. Funny enough typescript is kind of the opposite of coffee script in that it fixes a fundamental issue with JS (weak typing and a tendency to leak bad types downstream) without fixing the syntax while CS "fixes" the syntax without addressing the fundamental issues with the language.
  2. #2
    -SpectraL coward [the spuriously bluish-lilac bushman]
    http://opalrb.org/
  3. #3
    aldra JIDF Controlled Opposition
    lol, compile

    what is even the point?
  4. #4
    Lanny Bird of Courage
    http://opalrb.org/

    What did you think of it? Pros, cons, impressions?

    lol, compile

    what is even the point?

    Yeah, it's still compilation even if it doesn't target an assembly language. `javac` is the java -> bytecode compiler and JMV byte code certainly isn't assembly. I mean the google closure compiler is actually JS to JS. Generally the point is to remediate the many flaws of javascript, although what those flaws are will vary depending on who you ask. So like the authors of coffeescript clearly thought the syntax was JS's problem, clojurescript folks think the pervasive mutability is an issue (I'm pretty sympathetic to this argument) and MS thought the lack of a type system was causing enough problems that is warranted a new language to fix it. At least the latter two thought the lack of a proper module system was something worth fixing (god knows that's the truth). Looking at the way old ES6 got shot to shit (and it didn't even have that radical of changes, plus any new standard will takes years to gain usable levels of market adoption) it actually does seem like the best way to address issues is by making new languages.
  5. #5
    SBTlauien African Astronaut
    I've never used any of these but I've heard of CoffeScript. I would just stick to JavaScript rather than compiling to it. Unless there is some other benefit to doing so.
Jump to Top