A Tour of Alt-JS languages
References:
What makes a programming language good or bad?
There's many measures of what make a programing language good or bad. I'm going to attempt to take an approach that's very realistic for a business and it's customers. What really matters to them.
- Constant Iteration and Improvement
- If a business can't improve and grow quickly to meet the market's demand, if it can't fix it's mistakes in the past quickly enough for the competition to overtake them, they have a chance to fail. They must stay agile
- Software:
- Must keep codebase changeable within a reasonable amount of time
- Constant Rewrites are expensive, they must be kept to a minimum
- Ideally very little issues will come up, and when they do debugging and fixing issues should be cheap as possible
- Customer Happiness
- Sure, the product might work, but if it's slow, throws away someones data, doesn't work over a less than ideal connection. If it looks ugly and outdated next to it's competitors, it's popularity is likely to dip.
- Reliability is often
- People must power the business
- There must be people who a business can hire that will be able to learn the language quickly and write good code, and modify the code of their coworkers safely.
- There must be libraries to prevent people from spending time reinventing the wheel.
- The language must be enjoyable to use to keep up moral and stay for a long time.
About popularity...
Why Alt-JS? What's wrong with JS?
1995: Created as the result of a 10 day prototype with odd corporate mandates, such as “make it look like java” and fateful requirements to mimic poorly designed Java APIs4.
1996: Quickly adopted as the standard for client-side browser scripting.
1999: AJAX! Microsoft releases a non-standard javascript feature that would fundamentally change what browsers are capable of. Its usefulness can’t be denied and other browser vendors quickly adopt it.
2000-2008: Politics and disagreement stagnate the language. ES41, a perhaps overly-ambitious attempt to modernize javascript is abandoned. Javascript’s dynamic and interpreted nature are a detriment to performance, and a technical ceiling is hit.
2008: The release of Chrome and the V8 virtual machine, along with Mozilla’s TraceMonkey JIT, breathes new life into Javascript and client-side web development, improving the performance of javascript code by several factors.
2009: NodeJS is released, an isolated version of the V8 virtual machine with a standard library for running javascript outside of the browser. An entire ecosystem is born.
2010-Present: An explosion in javascript development. Communities create and evolve solutions to javascript’s many shortcomings. Javascript performance is such that other languages are now able to start transpiling to javascript. Nearly all javascript written over the past 23 years still works in all modern browsers.
reference: How we talk about other languages - Request Feedback - Elm Discourse
Let's be clear, JavaScript is not a "Garbage Fire" 🗑🔥
Many people, including myself in the past have ragged on JS for being a terrible language. I think this is absolutely wrong. JavaScript is the most popular programming language in world. It's become wildly popular among everyone, in many cases much of the hate has gone away. JS has improved to a huge degree.
JavaScript runs on more computers today than any other language
Let's come down to earth a little...
- It's literally the only language allowed to run the the browser, so maybe popularity is somewhat compulsory
- It's often hard to read other people's code that write in a different style or programing paradigm than you
- Rewrites seem very common (raise of handsâś‹)
- While it runs everywhere it tends to not be implemented ubiquitously. There's often missing features, or incompatibility.
Babel
History
maintained by Henry Zhu now, who works full time on it.
Good
- Makes your code cross browser compatible
- Extensible flexible compiler that lets you add new syntax.
- You can use Cool new features that are going to be in JavaScript!
- Async/Await
- Spread syntax
- Pattern matching
- Etc...
- You can use features that will probably be in JavaScript
- Decorators
- etc...
- You can use Cool new features that will never be in JavaScript!
- You can Use JSX!
- It's basically become synonymous with JavaScript
- You can use Cool new features that are going to be in JavaScript!
Bad
- You can use Cool new features that will never be in JavaScript!
- if the reason you used Babel was so that someday you'll be able to just stop compiling it, there's a decent chance you'll never get there, and you won't get there soon.
- It's far too
- You have to have source maps to tell what the original code
- Many of the less standard babel plugins break this.
- It's much slower than not using it.
- You get very little safety, for the price you pay in compilation time.
- Autocomplete is non-existant
- All the bad parts of JavaScript are still there
- Probably need to run ESLint on top of it. And webpack.
Ugly
It's 2020, Babel is the new CoffeeScript, you're left with a large codebase of non-standard JavaScript code that takes forever to compile. It's really hard to refactor your code now and you rewrite in a new language.
Typescript
History
Good
Bad
Ugly
Flow
Elm
Purescript
ClojureScript
ReasonML
The BuckleScript author estimates that the build system should scale to a few hundred thousands files in the current condition.
${YourBackendLanguage}Script
Talks that do a similar thing: (mostly by Jared)