Forgot your password?
typodupeerror
Google Programming Technology

Analysis of Google Dart 171

Posted by Unknown Lamer
from the google-announces-replacement-for-english dept.
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?"
This discussion has been archived. No new comments can be posted.

Analysis of Google Dart

Comments Filter:
  • by larry bagina (561269) on Monday October 24, 2011 @07:59PM (#37826144) Journal
    0 == false // expected
    1 == false // wtf?

    Yeah, everything except for true evaluates to false.

    • 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.

      • by jrumney (197329) on Monday October 24, 2011 @09:13PM (#37826704) Homepage
        In a strict typing sense, an exception makes sense. Pretending that any integer is either true or false is not strict typing, it is a convenience feature mostly offered for backwards compatibility with C, so making it incompatible with C like this makes no sense at all.
        • by Jesus_666 (702802)
          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"?

          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.
          • by jez9999 (618189)

            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.

            • by nschubach (922175)

              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.

            • by Jesus_666 (702802)
              Well, I did start my sentence with "and if you don't go the C compatibility route", so we already were in a situation where "do like C does" is not an option.

              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.
          • 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.

        • 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

      • by gutnor (872759) on Monday October 24, 2011 @09:24PM (#37826784)

        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".

      • by Tom (822)

        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.

        • by sgt scrub (869860)

          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

          • You don't need flush after an endl - endl is literally << '\n' followed by a flush.

            • by sgt scrub (869860)

              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. :)

      • by sgt scrub (869860)

        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.

    • by fermion (181285)
      My question would be what kind of language is Dart supposed to be. Is meant for rapid development? Is it there to allow incompetent coders to write code that is not error ridden? Does it exist to protect coders from any knowledge of how a computer operates? Is it the new just-above-bare-metal language It seems that we have all these already, and they work pretty well.
    • 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

      • 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".

    • by Ghjnut (1843450)
    • by sgt scrub (869860)

      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.

  • Maybe Dart is worth a second look?"

    nope! sorry google, we are still not interested

  • by sunderland56 (621843) on Monday October 24, 2011 @11:40PM (#37827694)

    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.

    • - Take some open source programs coded in other languages. (Not 20-line apps - things that are significant).
    • - Recode them in your new language of the day.
    • - Show how much (easier|faster|better|clearer|whatever) your new language is compared to the old ones.
    • by afabbro (33948) on Tuesday October 25, 2011 @02:04AM (#37828344) Homepage
      Even better, do something in your new language that we couldn't do before.
      • by mcvos (645701)

        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.

    • ..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 ...

  • http://code.google.com/p/jdart/ [google.com]

    Web is boring ;) Let's see Dart running on the Desktop.

  • Now I could just Google this, but I'm wondering what ever happened to Google Go [wikipedia.org]. Anyone here using it?

  • "Google's new language landed with a loud thud, causing lots of interesting debates [lambda-the-ultimate.org] about the best place to stick semicolons..." I did not RTFA but a search on the page for "semi" did not show any hits on semicolons. But then again. I know where they can stick their semicolons. But if I write it my post will be caught by the profanity filter.
    • by jez9999 (618189)

      Shit, you think Slashdot has a fucking profanity filter??

      • by Tsingi (870990)

        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.

      • Well it wouldn't block fucking shit, but the stuff he was going to write? Well, let's just say his words weren't as tame.
  • by Tom (822) on Tuesday October 25, 2011 @02:28AM (#37828446) Homepage Journal

    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.

    • by mcvos (645701)

      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.

      • by Rich0 (548339)

        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

        • by gauauu (649169)

          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.

    • by Tsingi (870990)

      Otherwise, no matter what your pitch is, I simply don't need it.

      OK.

    • 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.

    • by elrous0 (869638) *

      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!

Some people carve careers, others chisel them.

Working...