Blog Post

Erik Meijer and Gilad Bracha: Dart, Monads, Continuations, and More

Play Erik Meijer and Gilad Bracha: Dart, Monads, Continuations, and More

The Discussion

  • User profile image

    This question is for Gilad, specifically.

    I don't agree with Gilda's claim that type based overloading is a useless feature.

    I may be confused or there may be another way to get at this but given that you want to apply one logical operation to several different unrelated types (like save or load) then it appears that type based overloading is the only way to reduce needless duplication such as:
    saveInt( int)
    saveFloat( float)

    replaced with:

    Less duplication and the compiler automatically finds the right answer.

    Furthermore, with c++ traits based programming you can fairly explicitly tell the compile to apply an specific operation given a specific type, which seems like a generalization of type-based function overloading.

    How does a programmer in a typed language deal with the above situation without littering repetition all over their codebase?

  • User profile image

    It's like peanut butter and chocolate when those two get together!

  • User profile image

    @Chris: Type-classes.

  • User profile image

    oh, no TypeScript ?

  • User profile image

    @felix9: Not everything has to be about TypeScript.


  • User profile image

    @Chris: An in-practice example of the duplication you're talking about can actually be found in the visitor pattern in the Dart compiler (first 80 lines):

    Of course, because it's a dynamic language with optional typing you don't have to mention the type 2 times.

  • User profile image

    @Charles: Yeah of course, and this one is nice, nonetheless. But in those days everybody was wondering about Gilad's opinion on TypeScript, like, Mr. Optional Typing vs. Mr. Strong Typing Smiley 


  • User profile image

    @felix9: Ah, yes. This was filmed before the announcement, however...


  • User profile image

    This comment is my guessed reason for not using overloading.

    The form save(int) is not object oriented.
    Instead use:

    An OO method should be:
    - specific regarding its object (argument).
    Gilad avoids even such specifity in its Newspeak language by having only message passing even within an object; as far as I remember.
    - generic or abstract regarding the (other) arguments.
    The method parameter types indicate the requirements of the method regarding the corresponding arguments.

    Define types lazily based on what you need and not eagerly based on what you think you have or your what your object is.
    I guess this is the point of the Google Go language typesystem as well; but I might be mistaken here too.

  • User profile image

    Since it's not linked in the video description, here's the link to the Hewitt Channel9 video.

  • User profile image

    Type classes are the answer after checking out the wikipedia page.
    C++ traits structs are a more ad-hoc form of type classes,

    You are off the mark. I stated arbitrary types and you can't add every conceivable operation to every class. You need a way to extend types with arbitrary operations after the types have been created as a third party (not the creator of the types).


  • User profile image
    Niklas Ekstrom

    Gilad is a very smart man. I think he just changed my outlook on programming languages, somewhat.

    Great interview by Erik too, as always. Thanks Charles.

  • User profile image

    @Niklas Ekstrom: Agreed. Agreed. You're welcome. It's always an honor and pleasure to watch and listen to these guys.


  • User profile image

    Is there a list of Giladisms somewhere ? The two here make me want to know more Wink

  • User profile image

    Mathematics is a programming language for human brain.
    The main advantage of mathematics is flexibility.

    In mathematics it is possible to express all kinds of ideas in a very compact and flexible way.
    Existing programming languages have to comply with all kind of standards which significantly limit their flexibility and possible use in a human reasoning process.
    Mathematics is a "programming language" specially tuned for the use by humans.
    In mathematics we are constrained only by our imagination.
    Because of that mathematics is going to be the leading language for expressing human ideas in the future even in the world of programming languages.
    It is hard to describe new abstract concepts in for example "c".
    However, I believe that in a long run (many, many years) the future belongs to some kind of artificial reasoning techniques which will be based on some kind of future AI concepts.

  • User profile image

    Firstly, a very entertaining and engaging discussion. Nice work Charles!

    Secondly, as someone who has done a fair bit of Smalltalk, C#, Java and F#, I and can contribute from my experience.

    Smalltalk certainly has the cleanest syntax that  I have seen. It is a pleasure to work in that language (unfortunately it was all but wiped out by Java). It think it is the most stress free language that I can think of.

    Now I work mostly work in F# and I believe that I am better off than when I was working in either Smalltalk (or C# or Java).

    F# (or OCaml) has strong *type inference* so most of the time it does not *feel* that you are working in a strongly typed language. If you make a change, the types automatically propagate through. If there is a type conflict, the error gets flagged and you can fix it.

    While nothing is perfect, F# strikes a good balance between the extremes of Smalltalk and Haskell.



Add Your 2 Cents