Coffeehouse Thread

37 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

Dart

Back to Forum: Coffeehouse
  • User profile image
    exoteric

    Thoughts on the new Dart language from Google by the Bak, Bracha tandem?

    http://www.dartlang.org/docs/technical-overview/index.html

    Analysing...

  • User profile image
    Refrax

    hehe, i thought that was DART from the desktop optimization pack

  • User profile image
    AndyC

    I'm still not convinced of a genuine benefit of having untyped data in anything but a beginners programming tool. Yet the syntax is too advanced to really be a tool suitable for a beginner.

    To me you either go the whole hog and come up with something old school VB-esque, that pretty much anyone can understand and follow or you come up with a design aimed a professionals who are quite capable of making the decision that something ought to be an 'int' without difficulty.

  • User profile image
    wkempf

    @AndyC: It looks to me like DART is a typed language. The 'var' and 'finally' keywords do type inferrence, and your code remains statically typed. They do have a 'dynamic' keyword, much like C# does now, but there are scenarios where you'd prefer dynamic typing over static typing, so having the explicit option makes sense to me.

    Edit: Never mind, I'm not correct here. I'd read that elsewhere, but that's not quite what happens here. If you don't specify a type, Dynamic is assumed. Even if you specify a type, the "compiler" only produces warnings, not errors, when you make type violations. This is a whole lot better than a fully dynamic language, but isn't static typing.

  • User profile image
    Bass

    I think adding classes and interfaces is a big step backwards. JavaScript has it right with it's prototype-based object orientation and closures, it just needs to be cleaned up.

     

  • User profile image
    wkempf

    @Bass: I can't agree. If all your doing is light scripting that's fine. However, writing a rich application that way is a pain in the arse, and like it or not, that's what our web pages are moving towards.

  • User profile image
    exoteric

    , AndyC wrote

    I'm still not convinced of a genuine benefit of having untyped data in anything but a beginners programming tool. Yet the syntax is too advanced to really be a tool suitable for a beginner.

    To me you either go the whole hog and come up with something old school VB-esque, that pretty much anyone can understand and follow or you come up with a design aimed a professionals who are quite capable of making the decision that something ought to be an 'int' without difficulty.

    You find the syntax advanced? It looks very simple to me. Can't be much simpler. I'd perhaps prefer the "identifier then type" convention rather than the C legacy way but it looks neat.

    The semantics should also be easier to understand than prototypes.

    As a proof of concept someone should port jQuery to it.

  • User profile image
    exoteric

    , Bass wrote

    I think adding classes and interfaces is a big step backwards. JavaScript has it right with it's prototype-based object orientation and closures, it just needs to be cleaned up. 

    In all honesty, have you ever needed prototypes? That said, Dart is positioning itself not as a replacement to Javascript, but as a complementary language for large scale projects.

  • User profile image
    Bass

    I've never really seen a good argument for why Simula-based object orientation is better for large scale projects. You can perfectly emulate it using prototype-based object orientation anyway.

  • User profile image
    wkempf

    The inability to implement public/private/protected is enough to make the JS solution a pain (yes, I'm well aware of closure semantics that try to emulate some of this capability, emphasis on some, but in a manner that's really quite painful, IMHO). I don't have issues with prototyping (beyond that it means you have to be fully dynamic, which is another topic for discussion with regards to large scale applications), I have issues with JS in this area.

  • User profile image
    Bass

    @wkempf:

    That's a wholly tangential concern. You are arguing for better encapsulation/member-level permissions in JavaScript, not Simula-style objects.

  • User profile image
    Charles

    Not free to share my personal opinion on this as MJF would take it as representing Microsoft's opinion on the subject......

    You should read what pro lang designers are thinking/debating over at ltU and other places.

    C

  • User profile image
    exoteric

    , Bass wrote

    I've never really seen a good argument for why Simula-based object orientation is better for large scale projects. You can perfectly emulate it using prototype-based object orientation anyway.

    That didn't answer the question though. Have you ever found yourself needing prototypes?

  • User profile image
    wkempf

    @Bass: I did say that, but I don't feel it's "wholly tangential". I also pointed out (between the lines) that a big part of this debate has to do with static vs. dynamic typing. The tricky thing in this discussion is that the topic of the thread is DART, which remains a dynamic language. The lines here are very muddy.

  • User profile image
    Bass

    It is wholly tangential because you can add permissions very easily to a prototype based language. Eg:

    var blah = { private foo: "a", bar: "b" }
    
    blah.foo = "c"; //explode!

    Dynamic vs Static is a different story. You can also add something like static typing to a prototype based language, and actually in a way that is very flexible.

  • User profile image
    wkempf

    You took the easy way out and showed private. Now show protected. Also, once you've added static typing, how does a prototype differ from a class?

  • User profile image
    Bass

    @wkempf:

    var blah = { protected foo: "a", bar: "b" }
    puts(blah.foo); //explode or "undefined"
    var blah2 = { baz: foo }
    puts(blah2.baz); // explode or "undefined"
    blah2.prototype = blah;
    puts(blah2.baz); // "a"

    Regarding the static typing, it depends on what you want types for. I don't know what your specific criticisms of dynamic typing is, but generally speaking people who want static types really want contracts (some specific formalization of a unit test really).

    eg:

    function foo (blah where blah.foo != undefined)

    or with aliases that resemble interfaces.

    contract foo {
      contains bar which returns Number > 5
    }

    function foo (blah with contract foo)

    Note you can do some pretty powerful things with this that you can not do with the typical class/interface setup.

    contract field {
      contains +, -, /, *
    }

    function some_math_algorithm (blah with contract field)

  • User profile image
    wsdotnet

    Dart, this is great stuff. Classes and Types awesome stuff!!! 

    btw i did not read all the spec for dart but did i see generics? 

     

    Now where is my c# for the browser...microsoft???

    maybe silverlight/c# compile  to html5+Javscript.

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.