Slashdot Mirror


Compiling to JavaScript: TypeScript vs. Haxe

lars_doucet writes: Released in 2012, Microsoft's TypeScript is perhaps the best-known "compile to JS" language, but it wasn't the first. One of the earliest was Haxe, whose JS target first appeared in 2006. In his illuminating article, TypeScript vs Haxe, Andy Li gives an excellent rundown of the two languages' various merits, but the bottom line is: "Existing JS developers will favor TypeScript as they are more similar in many ways. They can utilize their existing skills immediately. Non-JS developers with backgrounds like Java/C# or even from the functional programming world will appreciate Haxe more since it fixes a lot of weirdness of JS." The full article includes an excellent rundown of the type systems, syntax, scope handling, compilers, and overall language design philosophy.

94 comments

  1. Dear lord why by Anonymous Coward · · Score: 4, Funny

    Compiling to JS is like having a shit for dinner, you're doing it wrong.

    1. Re:Dear lord why by leptons · · Score: 1, Flamebait

      Compiling to JS is like having a shit for dinner, you're doing it wrong.

      Denigrating JS is like having shit for brains, you're doing it wrong. FTFY.

    2. Re:Dear lord why by Anonymous Coward · · Score: 0, Insightful

      Why? It's a shit language that's grown way beyond its intended use.

    3. Re:Dear lord why by spamdog · · Score: 2, Insightful

      Oh come on. Shitting on javascript is timeless.

    4. Re:Dear lord why by iggymanz · · Score: 0

      No, supporting a poorly designed shit language used by shitheads to write bloated shit is rather shitty of you

    5. Re:Dear lord why by jandersen · · Score: 2

      Compiling to JS is like having a shit for dinner, you're doing it wrong.

      What are you talking about? 50 million flies can't be wrong.

    6. Re:Dear lord why by Anonymous Coward · · Score: 0

      Compiling to JS is like having a shit for dinner, you're doing it wrong.

      You're right, but at least the shit is polished.

    7. Re: Dear lord why by Anonymous Coward · · Score: 0

      2 dialects 1 cup

    8. Re:Dear lord why by Anonymous Coward · · Score: 3, Insightful

      How is this post marked flamebait but not the first original one?
      Javascript is proving to be one of the most widespread and widely adopted runtimes in the world.
      It is cashing cheques that java's ego wrote out.

      Compiling to JS is in fact the way most strong typed addicts are able to write javascript without losing their sanity.

      Mod Anonymous Coward down to flamebait and leptons to informative please!

    9. Re:Dear lord why by K.+S.+Kyosuke · · Score: 1

      Horrible syntax for people, pretty decent semantics for compiler backends for a fairly wide class of language. (About the only thing missing at the moment is tail calls.)

      --
      Ezekiel 23:20
    10. Re:Dear lord why by Anonymous Coward · · Score: 0

      Compiling to JS is in fact the way most strong typed addicts are able to write javascript without losing their sanity.

      So what you're saying is that developing in JS is actually terrible, that JS is a shitty language, and that it is to be used only as a runtime target for other languages to compile down to?

      So why don't we just dump JS and use something purpose-built to be a runtime environment?

    11. Re:Dear lord why by Anonymous Coward · · Score: 1

      You really don't have any concept of why there is javascript. Oh, I forgot - this is slashdot, where you're not a "real" programmer unless you use language XYZ. Fuck off Slashdot, you're all just putting your ignorance on display.

    12. Re:Dear lord why by iggymanz · · Score: 1

      There is Javascript for the same reason there is Visual Basic and PHP, to empower dullards and dimwits to be added to payroll rather than quality developers

    13. Re:Dear lord why by Anonymous Coward · · Score: 0

      So why don't we just dump JS and use something purpose-built to be a runtime environment?

      Yes, why don't we indeed?

    14. Re:Dear lord why by __aaclcg7560 · · Score: 1

      We're talking about JavaScript, not Windows. :P

    15. Re:Dear lord why by Anonymous Coward · · Score: 0

      Javascript is everything that was evil about Flash, before Flash was ever even invented.

    16. Re:Dear lord why by jandersen · · Score: 1

      We're talking about JavaScript, not Windows. :P

      Hey, I was joking; people often make ruder jokes about things they are fond of than about things they dislike. I like Javascript, but I'm not deeply convinced about the merits of compiling something to Javascript. Of course, this sort of idea isn't unknown in other languages, from C++ 'compiling' to C, or C to assembler, or diverse pre-processors like pro C/COBOL/FORTRAN etc - or for that matter IBM's HLASM. They have their place and offer some convenience, but they are not highly relevant to me.

      And don't speak badly about Windows; I've spent many happy hours watching people struggle with Windows, while I buzz along on my Linux system. I would be very sad if there were no more Windows systems to laugh at.

    17. Re:Dear lord why by __aaclcg7560 · · Score: 1

      I've spent many happy hours watching people struggle with Windows, while I buzz along on my Linux system.

      And I get paid big bucks to fix Windows problems between the keyboard and the chair at my job. Now that's job security.

  2. Pretty much what I expect from any /. article now by Anonymous Coward · · Score: 0

    > Which is the better compile-to-JS language? It depends

    I'm glad I skipped to the bottom.

  3. Compile to JS vs WebASM by Dutch+Gun · · Score: 4, Interesting

    How is that web assembly project coming along? It seems like a perfect fit for alternative languages like this instead of having to compile to JS. I think it will be a nice day when developers can choose a web language based on its merits rather than its ubiquitous nature.

    --
    Irony: Agile development has too much intertia to be abandoned now.
    1. Re:Compile to JS vs WebASM by Anonymous Coward · · Score: 0

      How is that web assembly project coming along? It seems like a perfect fit for alternative languages like this instead of having to compile to JS. I think it will be a nice day when developers can choose a web language based on its merits rather than its ubiquitous nature.

      What's actually wrong with Javascript as a compile target? Sure you can argue the problems with the language itself but when it's a compile target all of those are abstracted away, the thing that is important then is speed. And it's not exactly slow, could it be faster? Most likely. Does it need to be? For most cases probably not.

    2. Re:Compile to JS vs WebASM by Anonymous Coward · · Score: 0

      What's actually wrong with Javascript as a compile target?

      WebAssembly is conceived to go beyond what JavaScript can currently offer to better support more languages. The future features are of particular interest.

    3. Re:Compile to JS vs WebASM by Anonymous Coward · · Score: 0

      I think it will be a nice day when developers can choose a web language based on its merits rather than its ubiquitous nature.

      I agree. I want to be able to take my existing code base and have it run in a browser with as few changes as possible. WebAssembly will offer that in the future.

    4. Re:Compile to JS vs WebASM by thisisauniqueid · · Score: 4, Informative

      How is that web assembly project coming along? It seems like a perfect fit for alternative languages like this instead of having to compile to JS.

      WebAssembly is not currently a suitable target for Javascript compilation, because it lacks a garbage collector. Only languages that can base themselves on (the equivalent of) malloc/free can currently target wasm. Eventually garbage collection facilities will be provided, but they're not on the immediate drawing board, and even once garbage collection is possible, it's likely to be a long time before JS->wasm approaches the performance of v8 or similar. (Note that asm.js doesn't do garbage collection either.)

      The nice things about wasm are (1) it gives the creators a chance to re-invent the web runtime from the ground up (e.g. native threads will be there almost from the start), (2) languages can evolve independently of the web platform, and the web platform becomes language agnostic, and (3) *all* the major players are fully on-board.

      One of the nicest features of wasm, in my opinion, is that the intermediate representation is an AST of expressions to be computed. This is a far more sensible and flexible IR than some stack-based or register-based VM bytecode system. My prediction is that wasm will become the preferred compilation target for desktop/server applications, not just web applications: the same toolchain will be used to generate binaries for running in server containers as well as within a browser.

    5. Re:Compile to JS vs WebASM by thisisauniqueid · · Score: 3, Informative

      What's actually wrong with Javascript as a compile target?

      Where to even begin... maybe the fact that Javascript doesn't even have integers? Or that (other than in asm.js) it doesn't support C-style malloc/free heap-based allocation? Or that (again, other than in asm.js) the runtime is garbage collected? Or that it doesn't properly support threads (a huge deal given the demands of modern computing), or sharing of memory between WebWorkers and the main thread?

      Sure you can argue the problems with the language itself but when it's a compile target all of those are abstracted away, the thing that is important then is speed. And it's not exactly slow, could it be faster? Most likely. Does it need to be? For most cases probably not.

      Javascript wastes petawatt-hours of energy per year across the globe due to its computational inefficiency. That means your power bill is higher than it could be, your phone battery doesn't last as long as it could, and polar bears are dying in the Arctic because Javascript has been deemed "efficient enough".

      UI latency irks our subconscious. Once we have native WebAssembly support in browsers, and a significant percentage of the major websites have moved across to compiling from better languages into WebAssembly, those new sites are going to feel amazingly snappy, and people aren't going to want to use old Javascript sites, because they'll feel janky.

    6. Re:Compile to JS vs WebASM by Anonymous Coward · · Score: 0

      If you rely on a garbage collector without taking at least the same precautions that someone using malloc/free explicitly then it is very likely that you program takes three times the memory it should do and probably is bloated shit.
      There have been numerous claims that garbage collection finally works efficiently. It doesn't.

    7. Re:Compile to JS vs WebASM by Anonymous Coward · · Score: 0

      My prediction is that wasm will become the preferred compilation target for desktop/server applications

      You could do that with Haxe and NekoVM before Haxe even had a JS compilation target.

    8. Re:Compile to JS vs WebASM by serviscope_minor · · Score: 3, Insightful

      Once we have native WebAssembly support in browsers, and a significant percentage of the major websites have moved across to compiling from better languages into WebAssembly, those new sites are going to feel amazingly snappy, and people aren't going to want to use old Javascript sites, because they'll feel janky.

      Aaah you are in good fooling this morning, sir!

      Given that (a) computers have got vastly faster and (b) javascript engines have got vastly faster and (c) websites keep getting slower and slower, I somehow suspect that the future is not going to be a bright one like the distant past where UI lag was a rare thing.

      Here's another thing that irks me. The old "obsolete" X11 style was to have sub-sub-sub windows for damn near everything. Every UI element was in it's own subwindow. Subwindows were on the server, so when you clicked the mouse, it knew which subwindow you hit and sent that message. The modern, not "obsolete" style is to have one window and use pixel addressing.

      The former works much, much better in a world of UI and network lag. The common latter means you have the lovely thing where you press, the UI jumps and then processes the click afterwards so you hit the wrong place with sometimes hilaroius concepts.

      What's kind of funny is the web is slowly slouching towards a dubious re-inventing of the past 50 years of computing without bothering to learn anything about the old mistakes.

      Now I'm going to go back to poking badly documented registers on 4k 8051 microcontroller because frankly the web "technologies" makes that pile of insanity look good.

      --
      SJW n. One who posts facts.
    9. Re:Compile to JS vs WebASM by thisisauniqueid · · Score: 1

      You could do this with C/C++ too before C/C++ compiled to Javascript via Emscripten. That's kind of a tautology.

    10. Re:Compile to JS vs WebASM by Anonymous Coward · · Score: 0

      WebAssembly is not currently a suitable target for Javascript compilation

      He meant compiling other languages to WebAssembly, not JavaScript to WebAssembly.

    11. Re:Compile to JS vs WebASM by aaaaaaargh! · · Score: 2

      Here are my 2 cents on this "web thing":

      The language doesn't matter, the framework matters. I couldn't care less which language I use as long as the APIs are reasonable. But if I have to start considering abhorrences like HTML, encoding data into URLs, "cookies" and dealing with the intricacies of client/server responses, then my reaction is "no, thanks" - unless I'm forced to use the framework anyway.

      In other words, your language could be the shittiest possible and I'd still be fine with it as long as it allows me to write ordinary GUI apps with a reasonable gadget-based API that can be packed and deployed into browser-based applications easily. Most frameworks I've seen are simply too full of web-monkey crap. I don't want to fiddle around with lines and lines of boilerplate that has nothing to do with application development.

    12. Re:Compile to JS vs WebASM by aaaaaaargh! · · Score: 3, Interesting

      What's even worse is that people are piling up layers after layers without really caring about bug ratios and error tolerance. It's like building a skyscraper out of parts that all have a little bit of structural damage and saying each time: "Nah, that little hairline crack won't matter. I'm fairly confident that the whole thing will hold."

    13. Re:Compile to JS vs WebASM by Anonymous Coward · · Score: 1

      Funny, when Java was originally released I was only 16 and I read about this "bytecode stuff". For a while, I actually thought it was a compact, syntactical representation of the original Java program code (with comments, variable names etc. removed or replaced by numbers etc.). It seemed to me that would be the optimal way to get fast native code, since as little information as possible is thrown away, meaning that the compiler can better see the high-level constructs and find a good implementation in native code. Whereas the translation to byte code has already thrown a lot of information away that the JIT will have to try to reverse-engineer so it can apply those optimizations. In these SIMD imagine things like vectorization etc. must be easier to infer from the original code.

      Good to see they have not implemented it how I thought it was implemented :)

    14. Re:Compile to JS vs WebASM by Anonymous Coward · · Score: 0

      I mean, that they have now (or will soon) implement it as I thought :)

    15. Re:Compile to JS vs WebASM by Pieroxy · · Score: 1

      I agree that the fact that all major players are on board is a plus. That said, this is something we will sadly not be able to target for at least 6 years IMO. The most notable issue being the release cycle of Internet Explorer. If they decide to support their old platforms well, things could go faster. But the fact that we're still stuck with support for IE8 (or were until recently) is due to the fact that it's the newest IE for Windows XP, nothing else.

    16. Re: Compile to JS vs WebASM by Anonymous Coward · · Score: 0

      There should be no language in web. Wen shoul be just html and no dom, no ja

    17. Re:Compile to JS vs WebASM by Anonymous Coward · · Score: 0

      Global energy consumption last year was just over 100 petawatt-hours. You seriously think more than 1% of all energy use (including heating, smelting, all industrial processes worldwide) is on Javascript?

      If you're going to make up figures, at least make them half-way believable.

    18. Re:Compile to JS vs WebASM by Anonymous Coward · · Score: 0

      ...and this is why we should stop building on top of javascript, HTML and all the bullshit that comes with it. Instead of focusing on the most important aspect of the model (get the work done, and do it in a way that is clear, concise and not obfuscated), we get caught up in building layer upon layer upon layer of intricacy, obfuscate the interfaces with more APIs, insert yet more code and even more chances for bugs and security vulnerabilities, and then when shit starts blowing up we blame it on the framework when the reality is that everything was built on a shitty foundation in the first place. It's like trying to build a castle in the swamp, to plagiarize Monty Python.

      So, we learn the hard way that when you are faced with layers of complexity that are there to support legacy crap, sometimes its better to throw out the legacy (or at least let it exist on it's own terms, just stop supporting it) and scrape off the layers of complexity and give us a REAL model. We thought we had that with Web Assembly. We thought we had that with HTML 5. Instead, now we see them pandering to the masses who have become dependent on scads of legacy code, and we are now back to square one...yet another new standard that is getting dragged down by the anchor called javascript.

      The lesson we learn from the history of development is that if we continue to pander to what we have done before, we aren't able to take our work to the next level, and instead become mired down in mediocrity. It sucks to be one of the few who can actually see this.

    19. Re:Compile to JS vs WebASM by naasking · · Score: 1

      maybe the fact that Javascript doesn't even have integers?

      That's indeed a problem.

      Or that (other than in asm.js) it doesn't support C-style malloc/free heap-based allocation? Or that (again, other than in asm.js) the runtime is garbage collected? Or that it doesn't properly support threads (a huge deal given the demands of modern computing), or sharing of memory between WebWorkers and the main thread?

      Those aren't problems. Shared memory concurrency is hard, and we don't want the resulting bugs in our browser. Event loops are perfect in this domain.

      Manual memory allocation should never be the default; I'm not even sure it should be an option at all. If you're using JS for games, then what's really needed is simply latency annotations to indicate that low latency is more important than throughput in this context.

      The biggest JS problem IMO: weird implicit coercions resulting in surprising equalities and inequalities.

    20. Re:Compile to JS vs WebASM by Anonymous Coward · · Score: 1

      Or that it doesn't properly support threads (a huge deal given the demands of modern computing), or sharing of memory between WebWorkers and the main thread?

      It does properly support threads -> www.hamsters.io , and ES7 is introducing sharing of memory, although why you would want that vs using transferrable buffer (read pointers) is beyond me as it only introduces race conditions.

    21. Re:Compile to JS vs WebASM by serviscope_minor · · Score: 1

      "Nah, that little hairline crack won't matter. I'm fairly confident that the whole thing will hold."

      I mean if you plaster over the crack after filling it with chewing gum, you can't see it any more, so really, who cares?

      --
      SJW n. One who posts facts.
    22. Re:Compile to JS vs WebASM by frank_adrian314159 · · Score: 1

      What's kind of funny is the web is slowly slouching towards a dubious re-inventing of the past 50 years of computing without bothering to learn anything about the old mistakes.

      And this has been true of every technology change - from hardwired to microcoded computers to IC-based machines to microcomputes to SoCs, from mainframes to minis to workstations to PC's to phones and tablets, from Lisp to Scheme to Clojure, from Algol to Simula to Java, from standalone programs to client-server to web to Web x.y. The only surprising thing is that we continue to be surprised by this. The barbarians are always at the gate waiting for the next technological advances to release their supposed ignorance. But who's the bigger fool? The barbarian, or the one who doesn't acquiesce? We can see where the future lies. Make your bed for you must lie in it.

      --
      That is all.
    23. Re: Compile to JS vs WebASM by terjeber · · Score: 2

      Once we have native WebAssembly support in browsers

      ...six months after Linux wins the desktop war... In the mean time, for those of us who need to deliver solutions today, Typescript makes Javascript palatable.

    24. Re: Compile to JS vs WebASM by thisisauniqueid · · Score: 1

      There's a polyfill. Obviously.

    25. Re:Compile to JS vs WebASM by thisisauniqueid · · Score: 1

      There's a polyfill, so the (very alpha) prototype binary format of WebAssembly works on all Javascript-capable browsers today.

    26. Re:Compile to JS vs WebASM by luis_a_espinal · · Score: 1

      If you rely on a garbage collector without taking at least the same precautions that someone using malloc/free explicitly then it is very likely that you program takes three times the memory it should do and probably is bloated shit.

      Obligatory reference to Colbert

    27. Re:Compile to JS vs WebASM by Anonymous Coward · · Score: 0

      Best guess it that he was trying to get a (5, Funny)

    28. Re:Compile to JS vs WebASM by Anonymous Coward · · Score: 0

      >> maybe the fact that Javascript doesn't even have integers?
      > That's indeed a problem.

      It is if you need integers. Not dismissing such a need, if you have it, but what exactly do you need them for?

    29. Re:Compile to JS vs WebASM by MillionthMonkey · · Score: 1

      Petawatt hours of energy? I seriously doubt it- if you want to go 30 years into the past, all you need is 1.21 gigawatts.

    30. Re:Compile to JS vs WebASM by Anonymous Coward · · Score: 0

      That's because the people who are building a lot of this crap aren't computer scientists and don't know about any of that shit. They're ones that learned it on their own or were rushed through some vo-tech and are now calling themselves developers. Or worse yet, engineers. I guess that's what bugs me about the entire #whatanengineerlookslike nonsense. You read about some of these people's backgrounds and think "no way in hell are you an engineer". It's like a McD burger flipper calling themselves a chef.

    31. Re: Compile to JS vs WebASM by MemeRot · · Score: 1

      "when developers can choose a web language based on its merits rather than its ubiquitous nature." If it's not ubiquitous you don't put it in your site, full stop.

  4. The main thing about Haxe by Anonymous Coward · · Score: 0

    The main thing I like about Haxe is that variable scoping in closures work like you would expect. Javascript has the weirdest system for closures. Not sure about TypeScript, never used it.

    With that said, I typically write straight Javascript because come on, however broken, it's already a scripting language and how much more cruft do you want to add?! It's like fucking jQuery, blech. You're spraying perfume on shit. It just doesn't work.

  5. eeeeeexcellent by Anonymous Coward · · Score: 0

    The article is so good, it gets praised twice in the summary. Yet I've never heard of those languages, though I did know of "compile to javascript" contraptions and that at least half a dozen of those existed. So now these two are lodged in my mind as "ham-handed attempt at gaining mindshare by declaration of success" and "tries too hard to be the underdog". Neither a good place to be in. Welp, no reason to read this bit of stealth-marketing then.

    1. Re:eeeeeexcellent by thisisauniqueid · · Score: 2

      Haxe isn't very high-profile, but Typescript is an important language, if only for the fact that it is starting to drive the design of ECMAScript. Typescript has recently become a strict superset of ECMAScript functionality, and Typescript has become the new testing ground for features before they get incorporated into ECMAScript. (This may not always be true, because Typescript is developed by Microsoft, but it seems to be true at least for now. You know to sit up and start paying attention when Google decides to rebase one of their strategic platforms -- Angular -- on a Microsoft technology.)

    2. Re:eeeeeexcellent by msobkow · · Score: 1

      *sigh*

      ECMAScript IS Javascript. So what you're saying is Microsoft's compile-to-javascript tool is starting to define javascript itself.

      You don't see a problem with that?

      --
      I do not fail; I succeed at finding out what does not work.
    3. Re:eeeeeexcellent by thisisauniqueid · · Score: 3, Informative

      Um, I know that ECMAScript "IS" Javascript. Typescript is becoming much bigger than Microsoft itself. The only Microsoft products I have ever been interested in using before Typescript are their keyboards and mice. Typescript is, quite shockingly, actually really, really good, and Microsoft, even more shockingly, is suddenly becoming a really good citizen in the open source / Free software world, at least as far as some projects are concerned, and the stuff they're putting out there is really good. (See also: Visual Studio Code.)

      Microsoft have also, quite suddenly and inexplicably, become extremely open about the development process of some of these newer open source projects, and they are working with, and responding to, other key players in the open source ecosystem. (Google adopted Typescript for Angular2, and Microsoft merged Angular's "AtScript" extensions into Typescript, and made Typescript a strict superset of ECMAScript 7, in order to satisfy Google's requirements, and to make Typescript a better player in the Javascript world. Microsoft was a key presenter at, and participant in, ng-conf 2015. etc. etc.

    4. Re:eeeeeexcellent by Kr3m3Puff · · Score: 1

      The OP clearly said it was a "superset" of ECMAScript... meaning it adds more than what is in the standard but implements everything in the standard (which strictly isn't true, because it doesn't implement everything, but it does its best to not conflict with anything). Technically JavaScript is an implementation of ECMAScript (just like JScript was), but what the OP is saying it is true. TypeScript is having a lot of sway in TC39.

      --
      D.O.U.O.S.V.A.V.V.M.
    5. Re:eeeeeexcellent by tomhath · · Score: 1

      Typescript is, quite shockingly, actually really, really good...

      No shock really. I always thought C# is a good language, much better than Java. People have been burned by Microsoft non-standard extensions in the past; maybe it's different now. But everyone will be extra cautious.

    6. Re:eeeeeexcellent by Shados · · Score: 1

      Virtually nothing of TypeScript gets or will get incorporated into ES anytime soon. There's barely any significant strawman TC39 proposals based on it.

      The ES testing ground is Babel, where the new stuff is now being tested, and the tip of the community has aligned. TypeScript is playing catch up with it at best in term of standard EcmaScript features, and backtracking to match ES6 (eg: recently for the module syntax). It's also quite anemic in features, aside for the type system, which has pretty much zero chance of being adopted.

      Angular 2.0 is a trainwreck and technology deadend too, only building on top of Angular 1.X's popularity, and its adoption of TypeScript (which was initially supposed to be AtScript so they could have Java-style annotation, but trashed it when the EcmaScript community rejected it as the stupid idea it was and went all in on Python-like decorators instead) is the only reason TypeScript is on the map, along with Java and C# devs who are living in the past of classic-style OO programming instead of going functional like JS is doing (the only reason ES6 has a class keyword is because of historical context of 3+ years ago...it's not even really classes, and the keyword should be "dispatch" or something).

      Ouf, i feel better. Rant over.

  6. If I had to compile to JS I'd look at emscripten by istartedi · · Score: 3, Interesting

    If I had to compile to JS I like to think I could use emscripten, but not being involved in such a project I'm not sure how well it works. When it's supported by the browser, it's designed to strip away most of the layers of crap we've put between ourselves and the machine. IIRC, you can get half the speed of native C by running C compiled to JS this way. Once again though, the browser has to support it. I think in theory it can support any language that LLVM supports on the front end; but I think they've only tested it with C and C++.

    Anyway, if you're starting a new project I don't see why you'd want to use a language designed just for compiling to JS when you could use something more general purpose that will potentially run very fast with the proper compiler.

    --
    For all intensive purposes, "whom" is no longer a word. That begs the question, "who cares"?
  7. Unreal Engine by darkain · · Score: 1

    What about C/C++ and Unreal's scripting system all compiled to JavaScript? Epic has released several demos over the past couple years to show this off. https://www.youtube.com/watch?...

  8. TypeScript best known ? by Lennie · · Score: 1

    CoffeeScript is the best known and most popular, yes TypeScript probably comes second in these catagories.

    --
    New things are always on the horizon
    1. Re:TypeScript best known ? by h33t+l4x0r · · Score: 1

      Exactly what I was thinking. CoffeeScript has 2x the hits on Github or SO as TypeScript making it the clear front-runner.

    2. Re:TypeScript best known ? by hatchet · · Score: 1

      But still sucks. Actually all those mentioned compilers suck... and that's because javascript sucks, and you need to change the language to something that is at least strong typed (java, c#, python, ...)

      so you're left with something like: GWT, DuoCode, Bridge.NET...

    3. Re: TypeScript best known ? by Anonymous Coward · · Score: 0

      Umm... Python is strongly-typed? I suppose compared to JS, everything is strongly-typed.

    4. Re: TypeScript best known ? by Qzukk · · Score: 1

      Python is absolutely strongly typed. It's just not statically typed (variable names declared in advance with specific types). steve = 3 followed by steve = 'House' is perfectly fine due to dynamic typing, but if you follow that with bob = steve + 3 you get an error because steve is a string object, and adding a string object and an integer object together is not supported, and python makes no attempt to convert the type of steve or the type of 3 to force it to work.

      --
      If I have been able to see further than others, it is because I bought a pair of binoculars.
  9. Don't forget Scala.js by Anonymous Coward · · Score: 0

    I've been using Play with Scala.js (scala compiled to javascript) and find it promising.
    I'd like to see a good GUI toolkit to abstract away the dom as well as Akka actors that work between the browser and server.

  10. misunderstood by Anonymous Coward · · Score: 0

    most people that think js weird are nazis. they think that there would be a perfect machine. in opose of common sense, cause most developers think in c, in other words, think statically. js is lower level than c and at same time higher level than c. and its not perfect, not because its not c. but its world wide.

    1. Re:misunderstood by Viol8 · · Score: 1

      "most people that think js weird are nazis"

      And people who compare trivial dislikes with nazism are silly little kids with no clue about history.

      "js is lower level than c"

      And in your case no clue about what low level means either. Go on, amaze us. Tell us some low level functionality that JS can do that C can't. Please bear in mind that most javascript engines are written in C/C++. Just thought I'd let you know that before you make a complete idiot of yourself.

    2. Re: misunderstood by Anonymous Coward · · Score: 0

      Tragically, you were too late.

  11. Fairly early on the scene by jblues · · Score: 1

    Another one that came fairly early onto the scene was Objective-J, which allows programming browser contained applications in the idiom of Cocoa and Objective-C. I haven't really tried it myself, but it looked like a fun curiosity.

    --
    If it acquires resources on instantiation like a duck, then its a shared_ptr<Duck>
  12. Other languages targeting the JS runtime by geggo98 · · Score: 2

    There are also PureScript, Scala.js and of course ClojureScript.

  13. GWT by Anonymous Coward · · Score: 0

    Its amazing that anyone would think worrying about how to declare arrays or for each loops are the big deal to web development with Javascript.

    Everyone do yourself a favour and look at GWT and its zillions of features that help you solve and do the web right. Image sprites, embedding images via base64 where possible, abstractions over dom inconsistencies, support for differences for different browsers, auto css obsfucation and class name reference validation, and many many more things.

    Let me know how much more effort you have to do to get half of those things as part of your experience.

  14. Not that bad by monkeyxpress · · Score: 4, Insightful

    I know this is going to get a lot of hate, but JavaScript is really not as bad as people make out. There are some stupid design decisions (mostly around scoping and built-in type consistency) but once you know what these are it is pretty easy to work with them. The main problem I think most people have is that it does not really offer any sort of hand-holding in terms of how you should structure your program. But in a way it is quite beautiful how you can create usable frameworks for OO, imperative, or functional programming with the same language. The problem I mostly see is that people get stuck with a poor design decision, but rather than having to re-factor their object structure (like C# would force you to do), they can just hack in a solution that breaks basically every principle of good programming imaginable. They then dump this solution on the world and declare it is because JavaScript sucks. The real issue is that they are bad programmers who came up with a poor design and then used the (somewhat excessive) flexibility of JavaScript to get them out of a corner. Same thing has happened in C/C++ for years.

    I really don't think JavaScript should have become the language of the web, but competent programmers shouldn't listen to all the hate that gets spread around. It is a decent way to introduce yourself to a lot of new programming concepts if you've come from a static OO language background. Once you understand some fundamentals CoffeeScript, TypeScript etc are pretty straight forward and their applicability is obvious.

    For what it's worth, if you are doing large programs then something like TypeScript can be very useful. The problem it solves is really an issue with dynamic languages in general though, rather than JavaScript. There are ways to create large maintainable code bases with a dynamic prototypical language, but sometimes the classic OO model just fits a problem better.

    1. Re:Not that bad by Anonymous Coward · · Score: 1

      The main problem I think most people have is that it does not really offer any sort of hand-holding in terms of how you should structure your program. But in a way it is quite beautiful how you can create usable frameworks for OO, imperative, or functional programming with the same language.

      If that was the problem then people would be complaining a lot more about Lua, which leans way harder on the 'no hand holding, build it your way' thing than JS does.

    2. Re:Not that bad by JustAnotherOldGuy · · Score: 2

      I agree- although javascript has some bad design flaws, it's actually an enormously useful tool for which there is no real replacement.

      For example, how else would one do any kind of dynamic page manipulation? Yes, JS has flaws, but it works fine for what it does. It was never meant to be used to create huge, enterprise applications...I mean, who would write (for example) a medical billing application in JS? No one, because there are better languages for that. But for client-side page manipulation and calculation, JS is the best (and probably only) choice.

      --
      Just cruising through this digital world at 33 1/3 rpm...
    3. Re:Not that bad by Anonymous Coward · · Score: 0

      Nobody's complaining about Lua because Lua isn't as widespread as JavaScript is.

    4. Re:Not that bad by jjn1056 · · Score: 1

      Agreed, JS is far from a terrible language, just the few nasty bits you have to work around (and there' have been accepted workarounds for years).

      That said I tend to use Typescript now since its a smaller cognitive leap to TS from my strongest language skill.

      --
      Peace, or Not?
    5. Re:Not that bad by dwpro · · Score: 1

      The main problem I think most people have is that it does not really offer any sort of hand-holding in terms of how you should structure your program. But in a way it is quite beautiful how you can create usable frameworks for OO, imperative, or functional programming with the same language.

      True. I write straight machine code for the self-same reason; flexibility of writing expansive and divergent frameworks with none of the pesky hand-holding. It's so beautiful!

      --
      Millions long for immortality who do not know what to do with themselves on a rainy Sunday afternoon. -- Susan Ertz
    6. Re:Not that bad by Raenex · · Score: 1

      Yes, JS has flaws, but it works fine for what it does. It was never meant to be used to create huge, enterprise applications...I mean, who would write (for example) a medical billing application in JS? No one, because there are better languages for that.

      And yet there's Node.js, which is JavaScript on the server side.

    7. Re:Not that bad by JustAnotherOldGuy · · Score: 1

      And yet there's Node.js, which is JavaScript on the server side.

      Yep, I've played with it, and if there's something it can't do I don't know what it is. It's powerful. There's also webkit core which can do some great stuff, but still...I wouldn't want to write anything seriously complex in it. That's probably just my preference. I suppose there really isn't any reason why you couldn't/wouldn't/shouldn't.

      But for client-side stuff javascript seems to be about the only commonly-supported means of getting stuff done. (Yes, there's Flash, but that has its own baggage as well, to say the least.)

      --
      Just cruising through this digital world at 33 1/3 rpm...
  15. OTish: same lang to write an OS and website logic? by rodia · · Score: 2

    If you think this is would be a good thing, try Nim, formerly known as Nimrod. Abstraction level between C and C++ and it compiles to JS. Apparently carries less runtime baggage than emscripten.

  16. That TFA is splattered with dumb image macros ... by Anonymous Coward · · Score: 0

    ... tells you all you need to know about how in-depth it is.

  17. So in other words its like java bytecode... by Viol8 · · Score: 1

    ...but less powerful? Sounds like a winner to me!

    Another re-invention of the wheel. No one liked JVMs running bytecode in browser applets, I see no reason why this will be any more successful.

    1. Re:So in other words its like java bytecode... by Anonymous Coward · · Score: 1

      Don't underestimate freedom. The only reason javascript is popular is because every browser has a javascript vm built in. Java was never built in to any browser. Being "built in" is a huge difference. This is not a reinvention of the wheel. It is improving the wheel by removing some of the restrictions of use.

    2. Re:So in other words its like java bytecode... by thisisauniqueid · · Score: 1

      It's the future. Go search for interviews with Brendan Eich on the subject of WebAssembly, and you'll see what I mean.

  18. The real question is... by JustAnotherOldGuy · · Score: 1

    What I want to know is how does Haxe compare to the javascript compiler in systemd?

    --
    Just cruising through this digital world at 33 1/3 rpm...
    1. Re:The real question is... by Anonymous Coward · · Score: 0

      Holy moly... systemd has a javascript compiler now?

    2. Re: The real question is... by Anonymous Coward · · Score: 0

      Wow, it all makes sense now!

      Of course if something out of Microsoft is praised as the new standard that everybody shall follow, or rather, subject to, it must be Poettering's systemd crap is lurking in the shadows.

      WTF does a startup manager need a JS co piler?!

  19. Ceylon by Anonymous Coward · · Score: 0

    Any insights on RedHat's Ceylon project? http://ceylon-lang.org/

  20. Re:If I had to compile to JS I'd look at emscripte by Anonymous Coward · · Score: 0

    The 3D modeling app- http://formit360.autodesk.com/app/ is done with Emscripten.

  21. Didn't we already have a compiled weblanguage? by johannesg · · Score: 1

    How is webasm different from Java?

    1. Re:Didn't we already have a compiled weblanguage? by Anonymous Coward · · Score: 0

      Spelling?

  22. Write in Java, compile to JavaScript by Anonymous Coward · · Score: 0

    There are newer, better ways to generate JavaScript using all the goodness of developing using Java language features
    One such tool that it good for this is TeaVM:
    http://teavm.org/