Linked by Thom Holwerda on Mon 10th Oct 2011 20:14 UTC, submitted by twitterfire
General Development "Google has released an early version of Dart, a new programming language designed to take some of the pain out of developing applications for the Web. But while it's an evolutionary improvement on JavaScript, Dart faces a hard uphill battle for acceptance."
Order by: Score:
js
by vivainio on Mon 10th Oct 2011 20:57 UTC
vivainio
Member since:
2008-12-26

Main problem with Dart is that it's not an evolutionary improvement on Javascript, it's an all new Virtual Machine.

So, none of your old js code will run with your new Dart code.

IMO, how google should have implemented this would have been to add optional type tracking in their v8 js engine optimization paths, and provide a thin frontend that turns dart language to javascript + extras.

This way, you could intermingle Dart and JS code freely.

I am a bit underwhelmed about Dart because google took this route. We already have CoffeeScript that is a great language that directly maps to JS code (but eliminates "function" keyword, has list comprehensions from python, has classes, etc.). CoffeeScript works seamlessly with JS code - can run it, can get run by it.

Reply Score: 6

RE: js
by burnttoys on Mon 10th Oct 2011 21:34 UTC in reply to "js"
burnttoys Member since:
2008-12-20

Hmmm... I do think it's a bit of a weird sell - that is to pitch this as a JS replacement but as an application language it's not too bad (I'll admit I haven't _really_ dug into it).

Standard sort of class/interface stuff going on. Generics look usable but, like Java, have nothing like the expressive, computational qualities of C++ templates.

Given the more rigorous type engine I'd expect faster code execution than JS too - probably less type/method searching going on.

However, 10 out of 10 for "isolates". They seem to have a solid memory and process model but have made the message sends "invisible" - that is a method invocation becomes a message send. The doc I read didn't go into a huge amount of detail on the actual implementation (are objects copied as they go across the process boundary or have they implemented a binder/ref count system with (maybe) CoW)? Simply hiding the implementation this way is good enough.

As an application programming language I wonder if it was a better use in Android? It can't be _too_ hard to port Java code to Dart once the libraries are put together and lets Google stick 2 fingers up to the over inflated ego of Mr Ellison.

Maybe getting it into browsers (even if only Chrome) is a good way of getting an implementation into developers hands.

Reply Score: 2

RE: js
by kloty on Mon 10th Oct 2011 21:52 UTC in reply to "js"
kloty Member since:
2005-07-07

If I understand correctly it is possible to translate Dart into Javascript. Please look at Point 3. in this file https://code.google.com/p/dart/source/browse/branches/bleeding_edge/...

Reply Score: 1

RE[2]: js
by fromz on Mon 10th Oct 2011 22:48 UTC in reply to "RE: js"
fromz Member since:
2011-10-10

Yeah I saw that too -- doubt it can use existing javascript libraries though - which is neither here nor there, I suppose. If the project were to succeed, in time we would see dart libraries created to fill the void. In that case, we could write in dart and convert to javascript for browsers which don't support dart natively.

Reply Score: 1

RE[3]: js
by Spiron on Tue 11th Oct 2011 00:23 UTC in reply to "RE[2]: js"
Spiron Member since:
2011-03-08

The ability to code in Javascript isn't being removed for sometime yet, that would be stupid. most sites these days incorporate some javascript so they wouldn't remove the ability to parse it for some time yet. All that dart is is a more senseible language for creating web-applications on, which is possible in javascript its just a pain

Reply Score: 1

RE[3]: js
by Bill Shooter of Bul on Tue 11th Oct 2011 14:16 UTC in reply to "RE[2]: js"
Bill Shooter of Bul Member since:
2006-07-14

Well, the main reason why I use Js libraries is because they make up for things that JS is missing. If dart already has them built in, then my use cases for those JS libraries is greatly decreased.

They are planning on modifying GWT to output dart at some point as well, and have hinted at a 100% dart version of it ( dart running on server, dart running in client).

Reply Score: 2

RE[2]: js
by vivainio on Tue 11th Oct 2011 18:45 UTC in reply to "RE: js"
vivainio Member since:
2008-12-26

If I understand correctly it is possible to translate Dart into Javascript. Please look at Point 3. in this file https://code.google.com/p/dart/source/browse/branches/bleeding_edge/...


Check out what Dart "Hello World" looks like when compiled to Javascript:

https://gist.github.com/1277224

No kidding.

CoffeeSctipt, OTOH, maps to JS quite directly.

Reply Score: 2

RE[3]: js
by adinas on Wed 12th Oct 2011 12:33 UTC in reply to "RE[2]: js"
adinas Member since:
2005-08-17

Only 17,259 lines of code. I can write that in less than a week. :-O

Reply Score: 1

RE[3]: js
by benhonghu on Wed 12th Oct 2011 23:14 UTC in reply to "RE[2]: js"
benhonghu Member since:
2008-08-24

Well Dart really is not supposed to be translated to Javascript to begin with. Once it's got its own VM on chrome I'd expect it to be lighter and faster than JS.

Reply Score: 1

RE[3]: js
by tbcpp on Thu 13th Oct 2011 12:44 UTC in reply to "RE[2]: js"
tbcpp Member since:
2006-02-06

I think the point is that you will then run the output of Dart through the Google Closure compiler. In that way all the extra cruft is stripped out.

ClojureScript does the same thing. A stock "unoptimzied" "Hello World" is pages and pages of standard library functions, but it is also designed to run through the Google Closure (no j in this case) compiler and have all the dead code removed. After that, you're left with a very compact optimized file.

Reply Score: 1

RE: js
by Clinton on Mon 10th Oct 2011 22:45 UTC in reply to "js"
Clinton Member since:
2005-07-05

Main problem with Dart is that it's not an evolutionary improvement on Javascript, it's an all new Virtual Machine.

So, none of your old js code will run with your new Dart code.


I think that is exactly why Dart, or any other full replacement for Javascript, is so tempting.

Javascript sucks a lot more than it should, which is why people are always trying to make it easier with things like jQuery and CoffeeScript. I think there is a great amount of merit to completely ditching the old and bringing in something new.

Reply Score: 6

RE[2]: js
by vivainio on Tue 11th Oct 2011 03:55 UTC in reply to "RE: js"
vivainio Member since:
2008-12-26



Javascript sucks a lot more than it should, which is why people are always trying to make it easier with things like jQuery and CoffeeScript. I think there is a great amount of merit to completely ditching the old and bringing in something new.


The fact that CoffeeScript is ok means you don't need to ditch js to get tolerable language.

Just add optional type definitions to underlying js engine, and you can use a better language like CoffeeScript and have the code run fast, while retaining compatibility.

Reply Score: 4

RE[3]: js
by Clinton on Tue 11th Oct 2011 05:10 UTC in reply to "RE[2]: js"
Clinton Member since:
2005-07-05

My point is that sometimes great things come from breaking compatibility. As nice as it may be, CoffeeScript is still just a crutch.

Reply Score: 3

RE: js
by _xmv on Tue 11th Oct 2011 13:25 UTC in reply to "js"
_xmv Member since:
2008-12-09

"not created here" syndrome i guess

Reply Score: 2

RE: js
by renox on Wed 12th Oct 2011 12:05 UTC in reply to "js"
renox Member since:
2005-07-06

We already have CoffeeScript that is a great language

Depends on the viewpoint, some don't like CoffeeScript because it doesn't have a 'let' or a 'var' for local scope and I guess that it has JavaScript view that "all number are floats" on this point I prefer Dart's big ints.

Reply Score: 2

RE[2]: js
by vivainio on Wed 12th Oct 2011 12:45 UTC in reply to "RE: js"
vivainio Member since:
2008-12-26


Depends on the viewpoint, some don't like CoffeeScript because it doesn't have a 'let' or a 'var' for local scope and I guess that it has JavaScript view that "all number are floats" on this point I prefer Dart's big ints.


Python and Ruby do just fine without let or var for local scope.

As for numeric model, CoffeeScript has no choice. It uses what Javascript provides, that's why it can be translated so directly to JS. It's a small price to pay for not needing a whole new Google specific VM.

Reply Score: 2

RE: js
by Panajev on Fri 14th Oct 2011 14:23 UTC in reply to "js"
Panajev Member since:
2008-01-09

JavaScript is the assembly language of the web. Dart is one of the many projects trying to build the C language of the web.

Edited 2011-10-14 14:24 UTC

Reply Score: 2

Python
by WorknMan on Tue 11th Oct 2011 00:11 UTC
WorknMan
Member since:
2005-11-13

So if this language takes Python as its role model and can be compiled to Javascript, why not just code in Python and use pyjamas?

http://pyjs.org

I ask this out of curiosity, as someone who does not do any web programming. I am interested in it, but I don't want to have to learn one language on the client (javascript) and then another for the server (php/perl/etc).

Reply Score: 4

RE: Python
by Slambert666 on Tue 11th Oct 2011 04:45 UTC in reply to "Python"
Slambert666 Member since:
2008-10-30

So if this language takes Python as its role model and can be compiled to Javascript, why not just code in Python and use pyjamas?


There is not much python in it.
It looks more like a simplified C# and it looks like it has the functionality of Script#, except for less browser support and less tool support.

But it is still early days and it does look very promising.

Reply Score: 2

I never spent the time learning JavaScript
by tuaris on Tue 11th Oct 2011 00:53 UTC
tuaris
Member since:
2007-08-05

Although I do some light JavaScript work, I never really spent the time learning the language expecting that one day it would either 1) be Replaced, or 2) improved upon.

So we have JQuery which is an improvement on the language, and now some alternatives such as C++ in the browser and this.

Reply Score: 1

zima Member since:
2005-07-06

Though... close to every language (among those in active usage) one day will be either 1) Replaced, or 2) improved upon. ;)

Maybe such is the reason for lots of (supposedly) shoddy JS around - enough people doing what you did / not bothering to learn its idiosyncrasies?

Reply Score: 2

Comment by redshift
by redshift on Tue 11th Oct 2011 00:53 UTC
redshift
Member since:
2006-05-06

The code samples looked a lot like javascript with some new foundation class names.

Reply Score: 1

Nothing new
by moondevil on Tue 11th Oct 2011 05:57 UTC
moondevil
Member since:
2005-07-08

I imagine that Dart will follow the same way as Google Wave.

We already have several compilers for current languages that compile to Javascript, why take a complete new language?

For me this is a kind of disappointment.

Reply Score: 2

Share
by heronote on Tue 11th Oct 2011 06:22 UTC
heronote
Member since:
2011-10-11
More like C++
by geleto on Tue 11th Oct 2011 08:28 UTC
geleto
Member since:
2005-07-06

Everybody says that Dart falls between Java and JavaScript. But to me - it looks quite close to C++. 99% of the C++ code I write can be trivially translated to Dart and a clever compiler should be able to optimize the result just as well as the C++ compiler. The most notable differences are with the memory manadgement and multithreading (isolates are nice, but different).

Generics look usable but, like Java, have nothing like the expressive, computational qualities of C++ templates.

Untyped classes/functions ARE templates, you just have to be carefull how you use them. For instance don't call an untyped function if the compiler does not know the types of the parameters you call it with.

Edited 2011-10-11 08:33 UTC

Reply Score: 1

What problem is solved by dart?
by spudley99 on Tue 11th Oct 2011 11:16 UTC
spudley99
Member since:
2009-03-25

Someone asked what exactly is the problem with Javascript that Google are trying to solve by creating Dart.

I would suggest that the answer to this question is that it wasn't invented by Google.

And don't forget -- this isn't the first time Google has tried this. We already have the Go language, which seems to be addressing a similar problem space.

Javascript has its flaws, just like any other language, but there's nothing that badly wrong with it that requires launching a whole other language to replace it.

Reply Score: 0

subterrific Member since:
2005-07-10

http://www.dartlang.org/docs/technical-overview/#goals

I seem to remember reading in the announcement of Dart that it is being designed by the authors of V8 and other virtual machines to work around the problems encountered when creating an optimized VM for a language like Javascript that was created without the benefit of that knowledge. TL;DR; - Speed and memory overhead for mobile devices.

Reply Score: 1

Interesting
by slashdev on Tue 11th Oct 2011 12:21 UTC
slashdev
Member since:
2006-05-14

There are a lot of issues with javascript/ECMAScript. Javascript was designed with scripting html elements in a single page in a single thread. We've now created full blown applications, detailed library APIs, graphed on asynchronous requests. When you start trying to create actual applications in javascript, you start seeing major issues, like packaging, there isnt a real namespace system in javascript, so external APIs can essentially overwrite functionally without notification. The early days of JQUERY/prototype/mootools was horrible, adding jquery and prototype to your site would have unexpected results, (prototype had features that overlapped jquery s) While javascript libraries are attempting to play nicer with each other (there are emerging coding standards and best practices that didnt exist 5 years ago)...but there is no language enforcement, which sits badly for some companies who create software at the "enterprise" level, that needs better assurances in stability and way more deterministic.

Threading and concurrency is another issue, though browsers are trying to fix this, firefox has webworkers...but again, its not a language thing.

The list goes on, javascript just isnt up to the task for the modern web. There IS a proposal out there to get javascript up to snuff (Harmony i think). Think of Google's Dart as a contingency plan just in case the ECMA process goes crazy again and everyone is held hostage for years (just look up javascript/ECMAScript 4 and why it was abandoned after years of work). Google is dependent on javascript/ECMAScript. Heck, Javascript is Google's lifeblood. It makes sense that they wont leave anything up to chance.

Edited 2011-10-11 12:23 UTC

Reply Score: 3

RE: Interesting
by Lennie on Wed 12th Oct 2011 17:25 UTC in reply to "Interesting"
Lennie Member since:
2007-09-22

Yes, there is a small possibility of clashing at runtime of variables.

But most of them go away as long as you make everything private:

http://javascript.crockford.com/private.html

JavaScript doesn't really need concurrency as everything is already async./event based.

The existing real problems are probably things like support for decimals. Obviously Crockford explains it here:

http://www.livestream.com/etsy/video?clipId=pla_1463e546-47ed-4a93-...

And how adding extra features to browsers because of compatibility with old browsers. But that problem isn't solved by Dart either. Any mistakes that get introduced in Dart will probably be in that language forever (or atleast for a very long time) too.

It is really stupid from Google to want to introduce something new if the current ECMA process is working correctly. They are actually undermining that.

Reply Score: 2

Silver Dart
by jessesmith on Tue 11th Oct 2011 12:23 UTC
jessesmith
Member since:
2010-03-11

I'm hoping Dart isn't going to replace JavaScript so much as place a layer of improvement over it. JavaScript is pretty good at what it does, when used properly. And Dart can compile code into JavaScript. I think this opens the door for larger, more complex applications to be written in Dart and then, optionally, run in environments that already support JavaScript.

Reply Score: 1

Looks promising for game development
by reduz on Tue 11th Oct 2011 13:51 UTC
reduz
Member since:
2006-02-25

VM Based, JIT, embeddable, type safe, very permissive license (unlike Java or Mono). I can see this taking over mono as the "scripting" language of choice.

Reply Score: 2

slashdev Member since:
2006-05-14

Just out of curiosity whats the difference between Mono's license (MIT/X11) and Dart's License?

Reply Score: 2

reduz Member since:
2006-02-25

It's not MIT/X11, read: www.mono-project.com/FAQ:_Licensing

LGPL does not allow embedding in, say, a PS3 game. Engines that use mono (like Unity) purchase special commercial licenses.

Reply Score: 2

Slambert666 Member since:
2008-10-30

LGPL does not allow embedding in, say, a PS3 game.


What on earth are you talking about? LGPL does in general (unless static link exception) not allow static linking into a non GPL program, that's it.

So LGPL does allow embedding into a PS3 game, commercial software. What they write is:

Mono is available to be licensed commercially if the LGPL/GPL/X11 combination is not suitable for you. Xamarin offers commercial licensing options to redistribute Mono under non-LGPL terms. If your organization intends to redistribute software which embeds or bundles Mono, but is unable to comply with the terms of GNU LGPL v2, the Ultimate Edition may be right for you.

Reply Score: 2

reduz Member since:
2006-02-25

You are forgetting two issues here.

1) Dynamic linking is usually not available on consoles/phones/etc.
2) Console developers explicitly forbid GPL licensed stuff into games (Nintendo).

So no, you can't use LGPL stuff there.

Reply Score: 2

Lennie Member since:
2007-09-22

1. I would know about that.
2. It also depends on the version of LGPL. LGPLv3 doesn't allow patents and has some clauses are trying to prevent "tivoization". But LGPLv2 is a lot more friendly.

Reply Score: 2

Soulbender Member since:
2005-08-18

Since when is mono the scripting language of choice?

Reply Score: 2

Did Google just fart?
by UltraZelda64 on Tue 11th Oct 2011 23:32 UTC
UltraZelda64
Member since:
2006-12-05

No, seriously; am I the only one who keeps misreading the headline as "Google Fart Unveiled?" If so, what a way to kill JavaScript. ;)

Reply Score: 2

farewell?
by eydaimon on Wed 12th Oct 2011 02:02 UTC
eydaimon
Member since:
2006-03-22

There's absolutely nothing that I can see from Dart that would make me want to touch it. At all. Bye Dart, we never even met. Hi Javascript, old friend.

Reply Score: 1

Won't be useful for years
by adinas on Wed 12th Oct 2011 12:38 UTC
adinas
Member since:
2005-08-17

Anyone building a website needs to have it work for 95% of their users. So even if dart is implemented today in FF and IE it will still take years before anybody can actually develop a site knowing that their users will be able to use it. So I wouldn't run out and start learning it just yet. We have time. a lot of time.

Reply Score: 1

Done by geeks ...
by -pekr- on Wed 12th Oct 2011 13:24 UTC
-pekr-
Member since:
2006-03-28

Oh, just look into the source code - AllThisLongOldSchoolAproachLetsAddEvenMoreHereToMakeItEvenCooler :-)

https://gist.github.com/1277224

What ppl seem to depreciate, is, that the popularity of the language might not be defined by thier uber-cool features.

As for me,I don't like this JAVAish syntax. Well anyway - ppl never learn. Programming should be for ppl, not robots or PhDs needing to feel they finally can utilise their college uber-knowledge.

JavaScript, Python - much more readable. And Google has Guido on-board. If Dart is supposed to replace JS, I wish it follows Google Wave route :-)

Reply Score: 1