Analysis of Google Dart 171
An anonymous reader writes "Google's new language landed with a loud thud, causing lots of interesting debates about the best place to stick semicolons... An article [in InfoQ] ... looks at some of the less discussed features. Snapshots seem to bring something like Smalltalk images and allow instant startup of applications (something Java has spent the last 15 years not delivering). Isolates are like OS processes and communicate with message passing — and as the article suggests, can fix the problem of Garbage Collection pauses by splitting up the heap (sounds like Erlang). There's more, mostly about features that remove some dynamic behavior in order to make startup and code analysis easier. Maybe Dart is worth a second look?"
can't believe they missed this one... (Score:5, Funny)
1 == false
Yeah, everything except for true evaluates to false.
Re: (Score:2)
People say Javascript has some typing oddities too.
Clearly it doesn't actually affect the quality or the usability of the language - JS seems to be used just fine.
It does make sense in a strict typing sense.
Re:can't believe they missed this one... (Score:4, Insightful)
Re: (Score:2)
Anyway, I just googled it and it appears that this behavior has been accepted as a bug [google.com]. Well, partially. If the bug is fixed as requested in the bug report, everything will default to true now, with only null and false being false.
Re: (Score:2)
And if you don't go the C compatibility route, wouldn't it make more sense to throw an exception when trying to treat a non-boolean like a boolean instead of saying "everything but boolean true is false"?
No, it would make sense to treat nonzero integers as true, which is what C does.
Re: (Score:2)
To be perfectly honest, I don't think it makes sense to confuse integers with boolean values. If you want it to be not 0, use (something != 0). Is it really that hard to say "if (myValue != 0) {...}" instead of the somewhat cryptic "if (myValue) {...}"? Is myValue a undefined? Is it 0? I find it interesting that people who use a strongly typed language accept that an int can also be a boolean.
Re: (Score:2)
Just for the record, I use "if (foo)" a lot and I like the construct. I don't use it a lot for comparisons against zero (false and null being much more common) but I can see how allowing zero in is a useful bit of syntactic sugar.
Re: (Score:2)
If the bug is fixed as requested in the bug report, everything will default to true now, with only null and false being false.
This actually makes sense, as it would bring it in line with many other dynamically typed languages.
Re: (Score:2)
For many languages where all types are reference types, it's pretty common to have the null reference to evaluate to false, and everything else (including integers, and specifically including 0) be true. For another similar example, take Scheme, where everything that's not the false value (#f) is true. Granted, this makes more sense for dynamically typed languages, but then Dart is one - its static typing is opt-in.
What's really weird is reversing this, as Dart does - not "false is false, everything else is
Re:can't believe they missed this one... (Score:5, Interesting)
Clearly it doesn't actually affect the quality or the usability of the language - JS seems to be used just fine.
That is a bit ironic talking about a language designed to replace JS because Google thinks JS is "unsalvageable".
Re: (Score:2)
Clearly it doesn't actually affect the quality or the usability of the language - JS seems to be used just fine.
Actually, JS sucks things I can't write without pissing off the profanity filter. Very few people use it without some library (prototype, jquery, etc.) shielding them from its worst. And it still blows. But it's there in all the browsers, so if you need web-applications with client-side functionality, that's what you use.
If anyone were to replace JS with a real programming language, with the same amount of browser-support, you can count me in on jumping ship.
Re: (Score:2)
Check out Cling. It is a perfect example of how C/C++ could be the "scripting language" used instead of ECMA. Think CINT for the browser. IMHO all scripting languages should be usable but...
http://root.cern.ch/drupal/content/what-cling [root.cern.ch]
#include <iostream>
using namespace std;
int main()
{
int array[8];
for(int x=0; x<8; x++)
{
cout
Re: (Score:2)
You don't need flush after an endl - endl is literally << '\n' followed by a flush.
Re: (Score:2)
Force of habit. I've always added a forced flush to the last output on CINT scripts to ensure a hang doesn't effect output. In an actual C++ application, that I've debugged and will strip, it would get removed. Sometimes. Maybe. OK I'm lazy it wouldn't get removed. :)
Re: (Score:2)
It also has meaningful white space (ala. Python) That's a non-starter for me, personally. I already have fun times with people deciding if they want to use tabs or spaces in their code. To make them meaningful just adds another pain in the ass.
Re: (Score:2)
With IE=8 still have 1/3 of browser marketshare, they'll have a fun time pushing Dart into lead with either "please, please, install our plugin"
LOL! You can get Chrome as an IE plugin.
I've been writing stuff that runs on anything but IE for the last 6 years, it's a pleasure. Who gives a fuck about IE?
1/3 market share means that it's primarily being used by people that run multiple browsers. I use them all, IE only for lame company proprietary stuff. The rest are at the bottom of the food chain, they don't know how to switch and no one feels sorry for them.
Re: (Score:2)
The whole, "I think I'll put a semicolon here. Meh. Why bother." thing in javascript still gets on my nerve. But. It is the only scripting language built into all browsers so wtf are you going to do? sigh.
Re: (Score:2)
rock-stars (Score:2)
0 == false // expected
1 == false // wtf?
Yeah, everything except for true evaluates to false.
Hmm, that is a bit stupid... I think the opposite rule — everything evaluates to true except for false (used by e.g. Lua) — makes a lot more sense. It'll trip up C programmers too, but at least it naturally supports the "have some value" idiom, where you can use false as an out-of-band "not initialized" value in statements like "if (var) do-something-with-var", or "if (! var) var = init-value;".
I get the feeling that the reason Google keeps coming up with new languages is not really that exis
Re: (Score:2)
I think the opposite rule — everything evaluates to true except for false (used by e.g. Lua) — makes a lot more sense.
Actually, Lua counts both 'false' and 'nil' as false. Since Lua silently returns nil for almost any reference to an undefined or missing variable, field, parameter or index, in practice the boolean checks in Lua feel rather "lax".
Re: (Score:2)
That makes sense to you? Really?
That's not quite what he said (and not how it works in Lua). A value "evaluates to true" only in a boolean context, such as e.g. a conditional statement. However, equality operator in Lua never coerces values - if they are of different types, such as int on one side and boolean on the other, they're simply not equal, and that's that.
The fact that Dart tries to do an automatic boolean coercion when a non-boolean is compared to a boolean is a flaw in its design, and a separate one from the fact that they trea
Re: (Score:2)
Re: (Score:2)
And this:
int a, b, c // creates interface a b and c instead defining them as type integer.
Just looking at it makes me want to shove a stick into my eye.
google pushing there own product (Score:2)
Maybe Dart is worth a second look?"
nope! sorry google, we are still not interested
New Programming Languages (Score:4, Insightful)
Every few days someone comes by with a new programming language claiming to be the best thing since sliced bread. Nobody every shows a scrap of proof.
Re:New Programming Languages (Score:4, Insightful)
Re: (Score:3)
There's nothing new to be done. There are only easier and safer ways to do it.
I recently saw a presentation that explained how all progress in programming language came through taking stuff away. Take away GOTO, take away global variables, take away lots of other stuff. Taking options away seems to give us more maintainable, easier to read programs with less boiler plate code. Taking away null seems like a good next step that Dart apparently didn't take.
Re: (Score:2)
..and then realise that it is unsupported on a major platform ...
Java is used because of it's near universal support
JavaScript is used because of it's near universal support
C/C++ is used because of it's near universal support
Python is used because of it's near universal support
There are far better languages, in all categories, but using them is pointless if the platform you are targeting does not have support for it; or the library, or program you want to use cannot interact with it ...
Re: (Score:2)
...haXe... is not used because no-one has every heard of it ....having good advertising also helps ...
Running Dart on the JVM (Score:2)
http://code.google.com/p/jdart/ [google.com]
Web is boring ;) Let's see Dart running on the Desktop.
Google Go (Score:2)
Now I could just Google this, but I'm wondering what ever happened to Google Go [wikipedia.org]. Anyone here using it?
Re: (Score:3)
Re: (Score:2)
I guess Google Go just stopped.
Where to stick the semicolons... (Score:2)
Re: (Score:2)
Shit, you think Slashdot has a fucking profanity filter??
Re: (Score:2)
Shit, you think Slashdot has a fucking profanity filter??
People keep saying that, I think what it means is that they either can't be bothered to, or just can't, write what they actually think in English.
If there was a profanity filter this place would be much less interesting.
Re: (Score:2)
problems and solutions (Score:3)
Like any other new programming language of the past decade, Dart sounds like a solution to problems I don't have.
Show me something that I can't do in existing, established languages. Or show me something that works considerably easier, faster or better - with the stress on considerably.
Otherwise, no matter what your pitch is, I simply don't need it.
Re: (Score:2)
Being considerably easier, faster or better to program in than javascript shouldn't be too hard. I've been wondering for years why nobody has proposed a superior replacement for javascript yet.
Re: (Score:2)
What I'd like to see is a way to write the client and the server components of a typical AJAXy application as a single work. When I look at the Dart tutorials/etc I see lots of examples of how the language can handle either side of the link, but nothing really that unifies the application.
If you could just describe what the application needs to do then the compiler would put all the logic possible on the back end, and then only relegate to the front-end presentation, validation, and maybe logic that is mor
Re: (Score:2)
What I'd like to see is a way to write the client and the server components of a typical AJAXy application as a single work.
I agree. The closest thing I've found so far is the Vaadin Framework [vaadin.com] for Java. Yes, it's another Java framework. No, it's not quite there in terms of being the best imaginable solution for what you're proposing. But practically, it's the best that I've found. It has some rough edges, but overall, I've been impressed at how well they let you write the logic once, and their framework takes care of separating the front and back ends.
Re: (Score:2)
That's a library, not a language. It does fix one really big problem with Javascript, but in the end, you're still programming in the same confused hybrid language.
Re: (Score:2)
Otherwise, no matter what your pitch is, I simply don't need it.
OK.
Re: (Score:2)
Built-in message passing? Multi-threading without shared resources? Weak typing?
I know no other imperative language that offer that combination. Optional libraries - yes. But not at the core of the language. And optional libraries are pain to handle in the long term.
In the end, it boils down mostly to the simple fact: Dart is supported by Google AND Google has sufficient resources to kick start widespread adoption of the new language.
Re: (Score:2)
Dart sounds like a solution to problems I don't have.
Well, if it isn't little Lisa Simpson--Springfield's answer to a question NO ONE ASKED!
Re: (Score:2, Funny)
I have a little hint for you . . .
You're uglier than all of them.
Re:Girl analogy... (Score:4, Funny)
Many girls are worth a second look, but each time I try, they're still as ugly as they were...
I can't grasp girl analogies... can you please come with a car one?
Re: (Score:2)
It doesn't matter what angle you look at a Pontiac Aztec, it's still as ugly as it was when they first rolled it off the line. (?)
Re: (Score:2)
I thought the PT Cruiser was ugly, but the original Aztek looks like its bounding box was textured.
Re: (Score:2)
you are supposed to increase the amount of alcohol in your bloodstream inbetween looks...
Re:What? (Score:5, Interesting)
Oh please,
Java (or more correctly; its user base) has been crying out for some sort of faster startup since the mid 90s. No other problem has done more to keep Java off the desktop that the very slow startup times. If Java applets started as quickly as Flash objects manage to then we would still be seeing Java implemented on major web sites. I could never understand why Java doesn't snapshot and cache a prelinked version of a class the first time it loads, if anything the JVM is getting slower - the demo Java Applets on my website take about as long to start up in 2011 as they did in 2000 but my computer is many times faster.
Re: (Score:3)
The startup time is not significantly higher than a large binary application like Firefox or Chrome are.
You need to download some updates. Java 1.2 hasn't been used for a while.
Re: (Score:2)
Tsk. How'd I end up getting sucked into a Java discussion on a new technology thread? Must... resist.... urge... to... post...
Re: (Score:2)
.Net takes just as long to fire up an application on my box as Java does.
MS didn't get away with making Java proprietary, why do you think .Net exists? It's modelled on Java.
Re: (Score:2)
Actually, .NET apps typically take less to start, but that's because .NET exposes a way to pre-JIT bytecode on a given machine and cache that - NGen - which is usually done by the installer of a managed app. In theory, JVM could do the same thing - see Excelsior JET etc - it's just that few people seem to be interested.
Re: (Score:3)
Oh please,
Java (or more correctly; its user base) has been crying out for some sort of faster startup since the mid 90s. No other problem has done more to keep Java off the desktop that the very slow startup times. If Java applets started as quickly as Flash objects manage to then we would still be seeing Java implemented on major web sites. I could never understand why Java doesn't snapshot and cache a prelinked version of a class the first time it loads, if anything the JVM is getting slower - the demo Java Applets on my website take about as long to start up in 2011 as they did in 2000 but my computer is many times faster.
Maybe the Java that ships with OS X is specially optimized (I'm joking), but the background of your website takes longer to load and render than any of your applets do.
link [sandfly.net.nz]
This is fast enough for CLI usage outside of tight loops. For repeated usage, I'll concede you'd be better off finding a way to feed bulk data in rather than small chunks.
echo "class Hello {public static void main(String args[]) {System.out.println(\"Hello World\");}}" > Hello.java && javac Hello.java && time java Hel
Re:What? (Score:4, Insightful)
I understand Java is generally no speed demon compared to native compiled code, and desktop hard drive performance has almost stood still for ten years,
If by "stood still" you mean "almost tripled for mechanical drives", then yea, sure, i suppose.
Why Flash is fast (Score:4, Interesting)
If Java applets started as quickly as Flash objects manage to then we would still be seeing Java implemented on major web sites.
First, the Flash run-time is incredibly tiny. It used to be under 1MB, and it's still not all that much bigger. Compare to browsers that need 100MB to display "Hello, World".
Second, Flash can display without loading the entire file. It's an animation format, remember. There are two streams, a timeline of events and a collection of assets (images, etc.) As soon as some timeline data and the assets called out in it have been loaded, play can start. Files are explicitly laid out in time order of use. That was a really good design decision.
Java is just loading and running programs. There's nothing special about the way it starts. First the VM has to load, then the JIT compiler has to do its thing, and then you get to execute something. There's no explicit concept of time, as their is with Flash files.
Re: (Score:2)
Re:What? (Score:4, Interesting)
You an not wrong, but are missing the point. Java conceded the desktop to other technologies not because it was an inferior language (I find that even the much-maligned Swing produces very nice UIs) but because it took an age to start, making it unacceptable for any kind of in-browser use.
Re: (Score:2)
Swing
How DARE you even speak that word on a family forum, young man!
Re: (Score:2)
Re: (Score:2)
Flash is more powerful than you would think. I felt the same way you did until I started doing some stuff in it for a class. I've been doing DSP work (implemented an FFT among other things) as well as toying with a game (a game loop real game not some timeline BS). I even wrote a scripting language for said game that runs in Actionscript. "Sup dawg we heard you like scripting languages" I know I know :P
Re: (Score:3)
And you'll find that applets are slow because the Java plugin distributed and maintained by Sun/Oracle doesn't use any kind of preloading as far as I can see. Who knows if Dart is better in this regard, but Java is it's own worst enemy when it comes to startup times. It is a shame, because I like almost everything else about it.
Re: (Score:2)
Thank heavens. Preloading is not wanted if you don't know that the user is going to need it.
Re:What? (Score:4, Funny)
Xbox Live much, bro?
Re: (Score:2)
+1. I have never needed mod points this badly...
Re: (Score:2)
Wow. so many expletives. I won't bash Java, but it is certainly no faster at startup than its competitors. Coming from the .NET camp, I have to admit CLR apps are just as relatively slow to start, although the slow startup can be somewhat mitigated with pre-compilation.
Unless an app has high demands for startup or IO times, all managed (that includes you, Java!) languages suffer from the same initial performance hit while the runtime loads and data structures get cached. Stop the arguments about launch time
Re:What? (Score:4, Informative)
I just tried Hello World in Groovy and it took almost a whole second (measured with time: 0,7s avg, 0.952s max, 0.668s min) for it to run on my MacBookPro (latest high end 17" model, not ssd).
Perl did it in about 0.007s average (0.011s max, 0.003s min), Python in 0.020s average (0.023s max, 0.017s min).
So in practice it takes a 100 times longer to load with no libraries included, it get worse if you do have dependencies.
Not an issue for a server/deamon app, a real big deal if you need to write a command line tool.
Re: (Score:2)
Not an issue for a server/deamon app, a real big deal if you need to write a command line tool.
Many java services that I've had to start, they they've started, but they haven't ACTUALLY started. It's very annoying to start tomcat, get a response back suggesting things are a go, and then visiting localhost only to find out that started meant it started the paperwork to authorise the release of the forms for a port request, to be signed in triplicate and verified by 20 notaries.
But it hasn't actually started the service.
Re: (Score:2)
I hear you I manage a medium Tomcat farm (few hundred machines) and and some of the servers can take up to 15m to load (we have GBs of caches to fill) and we actually tail the tomcat logs to look for a 'ready to serve pages' notice.
Re: (Score:2)
Did anyone else read this whole thing in Sam Kinison's voice?
Re:What? (Score:5, Insightful)
Say I wanted to write ls in Java. Startup time would be very important to me. Having dived back into Java development recently the bloat is getting me down. Nobody does anything small, except on Android where Dalvik does some of the caching and optimizing instead of the normal Java runtime.
Re: (Score:2)
Say I wanted to write ls in Java. Startup time would be very important to me
They'd say your entire userland should be happening inside a JVM, so you wouldn't notice the startup time.
In some universes that may work.
Re: (Score:2)
Say I wanted to write ls in Java. Startup time would be very important to me
They'd say your entire userland should be happening inside a JVM, so you wouldn't notice the startup time.
In some universes that may work.
And I shall call it Eclipse.
Re: (Score:2)
Touché , Mr. Smith.
Re: (Score:2)
Oh Jesus fucking Christ! ...
+1 Funny
+1 Blasphemy
+1 for pissing yourself
+2 for admitting it
Re: (Score:2)
Re: (Score:2)
Re: (Score:2)
Re:What? (Score:4, Funny)
Did we strike a nerve?
Forgive us if the lack of a promise from Sun/Oracle to implement it didn't stop us from feeling it was necessary for startup times to be quicker than that of a slug crossing a freeway.
Re: (Score:2)
Re: (Score:2)
is the slug compiled or interpreted?
In the case of Java, it's both.
Java: All the restrictions of a compiled language, plus the inconveniences of an interpreted one!
Oracle is welcome to contact me, my services as a slogan-writer are available and quite reasonably priced (by Oracle standards).
Re: (Score:2)
Re: (Score:2)
Java may not have promised it, but earlier languages it copied from had it so maybe people assumed it was coming.
Re: (Score:2)
Re: (Score:2)
Re: (Score:2)
Dart means Dublin Area Rapid Transit.
I lost my umbrella on it, if anyone finds it, I'd like it back.
Re:Go or Dart? (Score:4, Interesting)
They are different. Is it surprising for one company to spin out more than one language? For a company of their size and age, Google has actually not invented very many. Compare to Microsoft, Apple, Sun, and Adobe who have each created several.
Your point is valid, but MS, Apple, and Sun were all operating system publishers and creating languages makes sense. Adobe was long a tool maker and their languages were tooly.
Google has become an operating system publisher only relatively recently (Android) and these languages don't target that platform. You could argue ChromeOS is an operating system but really that's just a Linux distro.
Google creating programming languages is sort of like Yahoo or Facebook creating programming languages. In Google's case, I suspect that these creations have little to do with their actual corporate mission and more to do with their wildly undisciplined engineering management.
(That doesn't indicate they're good or bad languages, of course.)
Re:Go or Dart? (Score:4, Interesting)
Google creating programming languages is sort of like Yahoo or Facebook creating programming languages. In Google's case, I suspect that these creations have little to do with their actual corporate mission and more to do with their wildly undisciplined engineering management.
(That doesn't indicate they're good or bad languages, of course.)
It also doesn't indicate that "undisciplined" is bad in any way. A lot of the successful Google projects have come out of their "long leash" attitude towards their coders.
Re: (Score:2)
Your point is valid, but MS, Apple, and Sun were all operating system publishers and creating languages makes sense.
There are many successful programming languages that did not come from operating system publishers. Java is very successful but that has little to do with the fact that Sun was an OS maker. People found and continue to find Java useful. Javascript is supremely popular. It was made by Netscape. A browser maker. What about PHP? And Perl? Python? Only the .net languages are highly successful and currently developed by and intended to be used on a particular OS vendor's OS. On what do you base your opi
Re: (Score:2)
Take a look at Scala. It very effectively does away with null.
The major way it does this, is by introducing the Option type. An Option can be either Some(value) or None. It's typed of course, so Option could be Some("foo"), Some("bar") or None. And Option is secretly a List with either 1 or 0 elements, so you can access the value by performing an operation on every element of the list (each). Or you can use getOrElse(alternative), where the alternative is what needs to be returned if the option happens to b
Re: (Score:2)
Take a look at Scala. It very effectively does away with null.
The major way it does this, is by introducing the Option type. An Option can be either Some(value) or None.
None is what Python uses for null.
Re: (Score:2)
I'm still slightly confused. "None" "0" "null design patterns" "undefined" "None option types" still sound like names for the same concept. Why is one solution better than another?
They are different things. We were talking about booleans, I'm of the opinion that you have to decide that it matters or it doesn't.
If want strict typing, then booleans should be 'true' 'false' or an exception should be thrown.
If you don't want strict typing, then an empty string, NULL null, 0, None, undefined, and false or any other concept of nothing that you might have in your language should evaluate to false.
Anything in between is a nonsensical hack.
Re: (Score:2)
If you need a "design pattern" to work around the fact that your language doesn't allow you to abstract away repeated boilerplate code and say what you really mean instead of what the language forces you to pretend you mean, then that's not an alternative, it's a design flaw in the language.
Re: (Score:2)
Not that I'm disagreeing, but why would you need 'null' and 'undefined'? I think it leads to easily to trinary conditions. If your object is empty, undefine/delete it.
Re: (Score:2)
In other words: You either have NULL or you have Null; That, or you have null...
Or 0, which should evaluate to false. Unless everything that is not true or false throws an exception where a boolean is required, which would be fine. /dev/null
Then there is undefined, which I will not attempt to define. >
Re: (Score:2)
Smalltalks seem to be doing well lately. It's not that weird for Google to jump on that bandwagon, is it? In any case, it can't be worse than Javascript.
Re: (Score:2)
. net sucks. Perl, Pascal, all interpreted languages are a dead end. They're ui elements that don't count. If you can't use your available source to build theOS the compiler and core apps, you lose.
An example of an OS or a libc (or analogous system library) written without assembler in studio please!
Re: (Score:2)
Humor. It is a difficult concept. It is not logical.