0 Favourites

DART as a javascript replacement?

  • http://active.tutsplus.com/articles/explanatory/what-is-dart-and-why-should-you-care/

    Found the above post explaining a bit about DART, google's new object-oriented language, engineered to replace javascript.

    While the criticisms are valid (that supporting an additional, non-standard, web facing language defined without consensus is bad) and we do have ECMA "Harmony" coming up, I'd like to see some discussion on the theme.

    Also not mentioned are the problems the language is meant to solve - for instance, google claims javascript has been doing a lot of things it was never meant to do with HTML5, but what's exactly the problem? I fail to see anything javascript can't do that other languages can (javascript is turing complete), so it's not about features (unless you count the specs and sandboxing, but then every language is going to have to abide).

    Would it be faster than javascript? if so, how faster? Is it worth the change?

  • Would it be faster than javascript? if so, how faster? Is it worth the change?

    About the performance, I have no clue, about if it is worth the change, I'd say it depends if you're willing to trade the cross-platform ability of js/HTML5 to a "work only in chrome" environment and if it brings you any benefit.

    As far as C2 is concerned, I believe Ashley will stick to JS/HTML5 no matter what until the HTML5 exporter is considered finished.

    He has spent already so much time, a switch now to a lesser spread platform would make few sense.

  • Well yes, it makes no sense to change to dart at this point, especially if other browsers decide against it.

    Do you think this language has any future? If it remains a "chrome only" thing, it will obviously die a la "activeX" or vbscript.

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • Both Mozilla and Google are working on JS replacements - "Rust" and DART respectively. They would both be a bit faster than JS. However, using either would involve rewriting the entire engine and possibly all third party plugins and behaviours - just for a small performance boost in one browser. So right now, totally not worth it.

  • Very comprehensive and well-informed overview here.

    From the conclusion:

    <font face="Verdana, Arial, Helvetica, sans-serif"><font color="blue">"If it were still 1995, and if Netscape Inc. had to pick between JavaScript and Dart for its scripting language, Dart would plainly be the better choice. Dart has had 16 years to learn from JavaScript's mistakes; it's no wonder that it avoids most of JavaScript's pitfalls.

    "But it's now 2011, and JavaScript is the language that's out there and has the support. Even if the major browser vendors committed to providing native Dart support tomorrow, it's in a sense too late; it will be decades before a browser vendor could even consider dropping JavaScript. The language is very much here to stay."</font></font>

    Scirra's on the right road.

  • (disclaimer, I work with the Dart team)

    Luckily, Dart compiles to modern JavaScript, so it will run across modern browsers. You don't need to wait for other browsers to directly adopt Dart. Heck, it's not even in Chrome yet (although you can get a binary build of Chromium+Dart VM for testing).

    As for "what exactly is the problem", it really depends on the scope of the project. For very small apps, JavaScript is doing great. Sure, startup performance can be much better (imagine if you had to parse all the C code just to run your browser every time you started it up!), there's no built in libraries/modules, and there are dark alleys to avoid. But, as has been demonstrated, there's a lot of great apps written with JavaScript on the web.

    However, we feel the web needs more complex, more performant apps (eg more apps on the size of Google Docs). With user expectations shifting to apps, we feel the web needs to remain competitive to the demands of modern app developers. We'd like to help keep the web a compelling platform for developers from all platforms, like Android, iOS, and .NET. Those developers have a different set of expectations of their tools, languages, and platform. Dart is a project that aims to be a solid choice for developers building more structured web apps.

    There are two core tenets to Dart: must be instantly familiar and must compile to sane modern JavaScript. Those are very interesting and challenging design and engineering constraints, but we know and feel they are critical for the web at large.

    As for performance, the team feels they can do better than the current crop of JavaScript engines. They should know, they build V8. :) However, it's early days so it remains to be seen how they'll do.

    It's very early for the Dart project, and Scirra is off and running. For now, you're definitely right, keep on the JavaScript train. The Dart team is working hard to build a 1.0 of the platform and SDK, but until then it's a good time to let us know what features you need or want.

    Hope that helps,

    Seth

  • Are the performance benefits negated by the "compiling to javascript" part?

    The greatest problem with ECMA Harmony is one that has plagued (and will continue to plague) the computer world for generations, and that is Backwards Compatibility. I see dart as way to do away with the old.

    That said, the greatest challenge would be to ensure it gets picked up fast, and it won't be done through developer adoption, but through cooperation with other vendors, and I don't see mozilla and microsoft rushing to adopt Dart, even if it's blazing fast and has a writeMyProgramForMe() function.

    The review linked above does point out some very interesting points, especially about trying to fork the web community being unhealthy, though I agree with google's assessment that javascript has fundamental flaws that are unlikely to ever be fixed (especially if the ECMA team decides to keep backward compatibility, as seems to be the current mindset).

    I mean, learning dart now would put one in a VERY advantageous position if it were ever to gain momentum, but if no one but chrome adopts it, it will remain forever a javascript translator, akin to coffeescript, which would just be sad, so I'd appreciate if someone could point me to a discussion on those topics (as I'm sure someone thought about this already).

  • Luckily, Dart compiles to modern JavaScript ... As for performance the team feels they can do better than the current crop of JavaScript engines. They should know, they build V8.

    While not taking away from my gratitude for V8 - great job, guys! - given that Dart compiles to JavaScript, I can't see that Dart would ever have it performance-wise over JS. Wouldn't every improvement in the engine necessarily be shared with JS? <img src="smileys/smiley5.gif" border="0" align="middle" />

  • Thanks for the input sethladd, I forgot Dart compiles to Javascript! However:

    Are the performance benefits negated by the "compiling to javascript" part?

    This is a very important point actually - suppose we did rewrite our entire engine in Dart *and* figured out how to interop Dart with our Javascript SDK. If that meant lost performance on other browsers and/or significantly increased code size downloads, that's another reason not to adopt it.

    I'm all in favour of a replacement language for Javascript, BTW. Dart is a great idea, but the practicality is it's unlikely to be worthwhile for a real engine like ours for the forseeable future.

    If it had mature and widespread support on mobile that'd be more significant, since performance is more of a problem on mobile. But still, it's a huge amount of work for a slither of performance improvement, and V8 is definitely fast enough for a lot of what we do.

  • While Dart may not be fully viable right now i really wish the best for it. I took a look at Rust and it's very interesting too. We really deserve something better than JS. One thing i believe: The monopoly of JS is at an end.

  • I'm very much looking forward to ES Harmony replacing ES5 (which with strict mode is already a reasonable language) in Q4 2013. I doubt Dart will have any impact.

    Edit:

  • I'm too. With Harmony JS may finally become decent and complete. But the way things are going surely JS monopoly will end. It has to. Monopoly is bad. JS is not a good tool for everything. Dart going together with JS would be perfect. You would keep using JS when adequate (game engines ? :)) and Dart for web apps that demand high modularization, multi core support at language level etc. Maybe then an adequate analogy would be JS is a 'systems' web language, like C and C++ are for desktop and Dart will be an 'app' web language like C# or Java.

  • Hi Trevor10, if all Dart ends up doing is push a much better JavaScript, it would still have an impact. Why would you wait for years for a new version of JavaScript when Dart is almost here? Even when Harmony lands, it'll still have to compile to ES5 JavaScript to be relevant.

    One way to look at it: GWT powers tons and tons of apps. It enables lots of developers to build for the web. This is a good thing, because more apps land on the web. Of course, GWT may not be right for you, that's OK. All that matters is more apps land on the web.

    I, too, am looking forward to Harmony and faster iterations on JavaScript.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
72 22,304
Ashley's avatar
Ashley Construct Team Founder
Unread hot topic
59 6,823
totoyan's avatar
totoyan
Unread hot topic
0 Favourites
[Plugin] Call Javascript
50 35,620
jailce's avatar
jailce