

Ask HN: Should I use languages that cross compile to JS? - sammorrowdrums

There seems to be a strong trend towards working away from vanilla JS. Is this a good thing?<p>My reservations are that adding a compile step with a dynamic language seems like added complexity and debugging (even though source maps and live reload tools help pretend it&#x27;s not the case), and that if JS is so bad to work with directly, why not support an alternative completely?<p>I&#x27;ve worked on a full project in CoffeeScript before, I&#x27;ve done the ASM.js hello world from C, I&#x27;ve also looked at Dart, Clojure and Typescript.<p>It just seams like those solutions are not taken by choice, but by necessity.<p>Thoughts? (hears can of worms open)
======
colept
Personally I prefer to avoid any kind of JavaScript simplifier just because I
view it as a crutch. When it comes to job interviews and being able to just
pick up and start coding, knowing how to do it purely is going to give you the
advantage.

The time it takes to get acquainted with these pre-compiled versions is hardly
worth the supposed savings in syntax or function writing.

~~~
Bahamut
I too believe in using vanilla JavaScript in general.

That said, for the OP's purposes, if you like the look of AtScript, by all
means, write it! If not, feel free not to use it or to move onto libraries
that don't - every choice you make has benefits and tradeoffs, make the ones
that make sense for your situation/fulfills what you want.

------
k__
Depends on what you're working on and how you work...

If you have legacy code in JS to work with and/or like full fledged IDEs,
you're probably better off with plain JS.

If you start new projects and are more of a TextMate/Sublime Text dev, you can
have fun times with compile-to-JS languages.

I was using plain JS for years, with some hand-made frameworks, ExtJS4 and
EmberJS and always used WebStorm.

When I switched to LiveScript, the IDE features didn't help me anymore and it
became a slow editor for me, so I switched to Sublime Text for editing and
coded some tools with GulpJS to automate the compilation.

So it's not just the languages, but their tooling and interaction with other
JS-code, you have to consider, when choosing what to use :)

------
erikpukinskis
I've done the last 10 months at work in CoffeeScript. The previous 12 were
full time client side JavaScript.

I think if you have a team of people dedicated to keeping your dev and build
environment working then CoffeeScript might be worth it. Maybe.

You just lose so much. You lose debugging tools. You lose being able to run
your code outside of a build environment. You lose being able to copy/paste
between your code and the browser. You lose being able to understand what
happens when you run your code (unless you memorize the full implementation of
CoffeeScript.) You lose being able to differentiate between foo and var foo.

I actually feel like there is a movement back in the other direction. Pure js.
Small modules that do one thing well. Functional programming. It's not a
terrible scene.

------
sammorrowdrums
Just FYI, this post was partly inspired by the fact Angular 2.0 seems to be a
mess of JS and Dart support via AtScript...

Good reasons or not, the added barrier to contributions, and choosing yet
another language that isn't JS still ultimately leads me to the conclusion
many at Google don't believe in JS in the long haul, not as a language to
write in.

[http://eisenbergeffect.bluespire.com/all-about-
angular-2-0/](http://eisenbergeffect.bluespire.com/all-about-angular-2-0/)

~~~
smt88
Writing a lot of JS makes you stop believing in JS for the long haul. It's
just impossible to write anything large without lots of fragility, and the
bugs are often incredibly subtle.

~~~
sammorrowdrums
I do work professionally writing JS (client side and Node.js), I see where you
are coming from, but I certainly found CoffeeScript had lots of new subtle
bugs and issues to replace the JS ones, and ultimately I wouldn't recommend it
over Vanilla JS. I don't exactly love it JS either, but I feel if I were to
really switch to something, it had better truly offer me something useful.

Facebook opt-in strict typing tool might be a decent option.

I also have many interests beyond JS, such as learning Go recently. I'm happy
to bin it for a better life, my real question is will I have a better life?

~~~
smt88
There are lots of alternatives other than CoffeeScript[1]. HN has recently
been full of "[some language] transpiler to JavaScript" posts. A strong type
system and more sane error-handling seem to be major motivators.

Glad to hear you've been learning Go -- there's a transpiler for that!

1\. [https://github.com/jashkenas/coffeescript/wiki/list-of-
langu...](https://github.com/jashkenas/coffeescript/wiki/list-of-languages-
that-compile-to-js)

------
zubairq
Try it, then decide for yourself. But yes, I use Clojurescript and much faster
then Javascript to release stuff as the language is so complete

