Javascript Alternatives
jster.net
jster.net
altjs isn't much better on the content front, but lists dozens more of these languages, and points you to an irc channel where you can talk about them.
[1]: http://ocsigen.org/js_of_ocaml/
There are also some cool frameworks for using OCaml on the server (although I haven't used them myself). So with OCaml you can use the same language for the frontend and the backend, which is always nice.
It's pretty cool.
* Dart has top-level variables and functions, Java does not. * Dart has optional static types, Java does not. * Dart programs start at main(), Java does not (see static initializers) * Dart has factory constructors, Java does not. * Dart has true lexical scope and nested functions, Java does not. * Dart doesn't need to be compiled into bytecode, Java does. * Dart's classes have implicit interfaces, Java does not. * Dart has auto generated getters and setters for fields, Java does not. * Dart has one-line function syntax, Java does not. * Everything in Dart is an object, Java has primitives. * Dart has only library privates, Java has public/protected/package/private. * Dart starts quicker than Java.
In all fairness, both Dart and Java and JavaScript use { } and ;
It is probably closest to TypeScript on the list, but is IMHO more mature and have more features (like generics).
Also just wanted to mention that Haxe3 is just around the corner...
Again, Haxe doesn't have as much traction as others, not because it's bad, but because it isn't fashionable. At least that's the only reason I can come up with why it hasn't resonated.
Looking at wikipedia (and I may be getting misinformed here) the most recent version of 'Javascript Extensions' is 1.8.1, and EMCA is on edition 5. However support for both of these seems patchy.
I often see mentions of all kinds of polyfills, but is there a nice library and/or compiler, which gives me access to the "Javascript of the future", on browsers which do not yet support it? Is this even a sensible thing to ask for?
You might want to check out Esprima (http://esprima.org/). You will find a couple of alternatives there. See http://code.google.com/p/traceur-compiler/ as well.
You cant magically make proxies , weakmaps ,let , or generators , or even modules(the python way) work just by adding a library to Javascript. You cant change inner workings of the language with functions.
If you could there would be no point creating a future version of the language.
All transpilers that compile down to javascript are basically syntaxic sugar generators , but do not add semantic like ES6 does.
However implementing them means a more complex compiler, more low-level resulting JS, and potentially a runtime within the JS runtime (essentially coding a VM in javascript, within which your language runs).
If an alternative language that compiles down to JavaScript is much cleaner and safer, and isn't compromised by the myriad of idiosyncrasies that bug JavaScript, then I think it definitely has its merits.
I really, honestly and adamantly despise JavaScript, probably because I used to write lots of JavaScript years ago in the IE4 age. Back then, nobody would even think about using JavaScript for anything but simple scripts embedded on webpages, that was what the language was designed for, and about the only thing it was capable of. It was slow, badly documented, lacking in features and it promoted terrible program design. A lot has changed in the mean time and while I haven't been writing any JavaScript since somewhere around the year 2000, I recognize that the language is now pretty capable and fast. But it still lugs around a hideous legacy that -as far as I'm concerned- can't die soon enough to be replaced by something better, running on the same VM.
Any alternative that hides the ugly wart that modern JavaScript grew out of, while we're waiting for a real and native replacement, is more than welcome.
There is nothing weird about abstractions. All modern languages are based on multiple levels of language abstractions.
Now it's one of the most widespread programming language in the world and there are thousands of great tutorials to learn it.
Take the time to do vanilla JS, it's not that hard and it's a very decent language to use daily.
I agree with your point though.
A VM is therefore not necessarily an improvement on JavaScript - it has to be a better VM than JavaScript, and nobody have designed that yet.
The XHR implementation looks pretty no-brainer as well: HTTP.get("/users/1.json") do |response| puts response.body end
This might be worth a go, but I suspect I will probably just keep using JS with jQuery directly. But at least it's cool to know that I can now do a full-stack Rails app including client-side scripting entirely in Ruby if I want to.
May be we shouldn't call them 'alternatives' but just 'wrappers' - JavaScript Wrappers. But again, that's not the point. Why?
I think that perhaps JS has not yet reached the point that asm has.
Not having to track braces, optional parenthesis, not having to type 'function' and others quickly add up. The result is very elegant and clean code. Having less code also means its quicker to identify bugs.