20 ms·
Dart Is Not the Language You Think It Is
- barabaraphil 13y agoThe language looks great. The challenge I think is always building enough of a community to create a rich enough stack that people can build real-world applications on. Scala did a fine job there, and a lot of that had to do with some companies taking some ownership of the platform (TypeSafe in that case), which may be good and/or bad. I wander what others think of this.
- melling 13y agoYour little typo "wander" instead of wonder kind of demonstrates the point of Dart. It's a language that seems to provide more of a safety net for developers. We all make trivial mistakes, probably daily. It's nice to have a little more support in a language to help us along. Throw in the extra performance (2x?) over Javascript and I'm ready to at least give it a try.
- sethladd 13y ago[disclaimer: I work on the Dart team] The Dart VM is 2X faster than V8 on a few benchmarks already. Check out https://www.dartlang.org/performance https://www.dartlang.org/performance We've still got a bunch of work to do, but the initial results are encouraging.
- stcredzero 13y agoHow about a virtual machine facility that outputs what the types of variables are at runtime, combined with tools that can collate data from many runs and apply consistent types back to the original source code?
- spankalee 13y agoMembers of the team and community have talk about such a tool, also tools that remove type annotations to prove that they don't effect performance, or remove them from local variables to match the style guide.
- spankalee 13y agoWow, I wonder why I got down-voted for stating something that was simply true. I guess it's bad the people discussed the possibilities of these tools? Interesting...
- zokier 13y agoResist complaining about being downmodded. It never does any good, and it makes boring reading. http://ycombinator.com/newsguidelines.html http://ycombinator.com/newsguidelines.html
- dietrichepp 13y agoThat's dangerous, because you have no way of knowing if you have 100% coverage without doing static analysis, and if you double check everything with static analysis, you might as well only do the static analysis in the first place. (Static analysis won't always give you an answer, but it won't ever give you a wrong answer.) I am reminded of the folks who optimized .kkrieger, which is a 95 kB first-person shooter. See "Metaprogramming for Madmen": http://fgiesen.wordpress.com/2012/04/08/metaprogramming-for-madmen/ http://fgiesen.wordpress.com/2012/04/08/metaprogramming-for-... Some highlights: during the test run, the player never pressed the up arrow key in the menu, so that functionality was removed by their tools. Enemies at the beginning never hit the player, so the code which handles damage was compiled out. And the system used a certain brand of graphics card, so code necessary for other graphics cards was compiled out. The lesson is: don't let tools change code semantics based only on black-box testing.
- stcredzero 13y ago> That's dangerous, because you have no way of knowing if you have 100% coverage without doing static analysis You are right from a theoretical standpoint, but I'm not so sure this fits with how web applications are known to run and the patterns development usually follows. Developers who shove an object of one type in an instance or temporary variable one time, and a different one another time are usually doing something bad, even in dynamic environments -- unless there is a specific interface involved. Just because "duck typing" is fast, doesn't mean that it has to be loose. The point, actually, is to discover where types are being misused as much as to discover what the types are. > The lesson is: don't let tools change code semantics based only on black-box testing. I'm also advocating this. However, it seems like you're mainly familiar with dealing with types in statically typed environments. In dynamic environments, the developers still need to know the types. Often, there are hard and fast rules only enforced by convention. This is indeed a source of errors, but by and large, programmers are very good at managing this. In other words, very often, the programmers will know. I see environments like Dart as a way to eliminate such conventions, but still enable very fast prototyping in the beginning. (Ultimately, static types are better for maintenance.)
- willlll 13y agoUntyped languages are okay. Typed languages are also okay. Typed languages with inference are okay. Optionally typed is extremely strange.
- dietrichepp 13y agoI think it's rather natural. Look at Haskell. Static typing with type inference was recently extended to allow "holes" in the type system. It lets you run broken programs, and let's be honest, my programs are broken (in some sense) most of the time. C++ lets you use the "auto" keyword in many places. Maybe the only thing strange here is that Dart has more of the "dynamic by default" mentality, but that's not strange either if you look at languages like Common Lisp, which have optional type annotations. Here's optional type annotations in Haskell, which uses type inference by default but lets you override types with annotations. Note that f and g have different types, but the same body. -- Haskell f = return 5 g :: IO Int g = return 5 Here it is in Lisp, which uses dynamic typing by default but lets you specify types with annotations. ; Dynamic +3 function (defun add3 (x) (+ x 3)) ; Static +3 function for integers (defun add3 (x) (declare (type integer x)) (+ x 3))
- jerf 13y agoOptionally specifying types which are otherwise inferred is not the same as optional typing. Haskell expressions always have a type. Often the compiler is smart enough to figure out what it is without you explicitly telling it, but it still has a type. Haskell typed holes still doesn't allow you to escape from the type system, it's more a way of saying "Here I am in the middle of an expression and I'm lost, could you tell me what fits here in your opinion Mr. Compiler?" It still has a type, it is not a way that you can just feed the compiler type-gibberish and move on. In Dart, the types appear to be little more than advisory documentation. I don't know Lisp; what happens to your add3 if you pass a thing that can't be added to 3? Does it crash at some sort of 'type checking phase' (whenever that may be) or only when it finally discovers it can't do the addition, essentially ignoring the type declaration? (Or both and neither, depending on what exact Lisp and macro set you're using, which is my guess.)
- andyl 13y agoTo me Dart looks like another brick in Google's walled garden. Weakening support for XMPP, Webkit, RSS, and JavaScript. Investment in so-called open technologies like NaCL and DART that are controlled by Google and optimized for Google's platform. Too bad.
- mythz 13y agoWalled garden?? It's the most open language I know, fully OSS'ed with an extended license to include any implicit patents (removing Patent FUD), developed out in the open and accepting 3rd party contributions and inviting feedback to influence language design. Lars Bak also mentioned at Google I/O that they're in the process of trying to get it standardized, not sure what's left to do to make it any more "open" and inviting.
- oinksoft 13y agoLet's not pretend that Google's open source products in any way follow an open development process. Do you notice anything in common about the recent committers? http://code.google.com/p/dart/source/list http://code.google.com/p/dart/source/list http://code.google.com/p/closure-compiler/source/list http://code.google.com/p/closure-compiler/source/list http://code.google.com/p/closure-library/source/list http://code.google.com/p/closure-library/source/list Their development is very much insular. That's not to say it's a poor idea to depend on these products, but they don't compare to projects like Python with formal processes for revisions (PEP) or at least some discussion. It would be nice if Google maintained mirrors on Github and accepted pull requests and such, but I don't see that ever happening.
- enneff 13y ago> Let's not pretend that Google's open source products in any way follow an open development process. You said "product", but you should say "project". If you want to assess the openness of the development process, look at the process itself: https://code.google.com/p/dart/wiki/Contributing https://code.google.com/p/dart/wiki/Contributing https://groups.google.com/a/dartlang.org/forum/?fromgroups#!forum/reviews https://groups.google.com/a/dartlang.org/forum/?fromgroups#!... If code reviews are happening in the open and there's a process to bring new contributors on board, that's a great start. This early in the game, you can't expect random members of the open source community to start contributing more than a dedicated team at Google. > It would be nice if Google maintained mirrors on Github and accepted pull requests and such, but I don't see that ever happening. Oh? http://github.com/google http://github.com/google https://github.com/dart-lang https://github.com/dart-lang Also, FWIW on the Go project we have more than 300 non-Google contributors and a solid core of dedicated committers. https://code.google.com/p/go/source/list https://code.google.com/p/go/source/list
- oakaz 13y agoHere is what I think about Dart: it is huge and is another programming planet that you can't reuse what you already have (like thousands of libraries in NPM). And the most important part; it looks boring. the articles about it look also are very boring.
- timothya 13y agoHere is what I think about Dart: it is huge and is another programming planet that you can't reuse what you already have (like thousands of libraries in NPM). Dart has a js-interop library for the times that you want to reuse some code written in JavaScript. This video gives a good introduction to it: http://www.youtube.com/watch?v=QFuCFUd2Zsw http://www.youtube.com/watch?v=QFuCFUd2Zsw And the most important part; it looks boring. That's was a big design goal when they created the language. It's designed so that, for the most part, it looks and behaves like other languages that you're used to. You can pick it up in an hour or so and be productive right away. The Dart team didn't want to create some esoteric language with all sorts of crazy features, they set out to create a real language that people would feel comfortable using.
- shurcooL 13y agoI like what I see in the article, but... I'm kinda put off by the seemingly high barrier of entry. All the tools they show off are great once you've started, but I don't want to install all that just to try a slightly more advanced "hello world" sample. It's really too bad there isn't an equivalent of play.golang.org for Dart. I would've given it a try right now if the barrier of entry were lower, and perhaps I'd be pleasantly surprised enough to keep using it. Also, is it possible to generate and execute Dart code within Dart (the way it is in dynamic languages like JS) without recompiling?
- ahoge 13y ago> It's really too bad there isn't an equivalent of play.golang.org for Dart. There is. http://try.dartlang.org http://try.dartlang.org Anyhow, the barrier is actually pretty low. The editor zip is about 140MB in size and contains everything you need: the SDK, the editor, and Dartium (Chromium + Dart VM).
- deleted 13y ago[deleted]
- rufugee 13y agoExactly what does this add to the conversation?
- mratzloff 13y ago// YOU ARE HAVING FUN NOW!!
- rdtsc 13y agoIs that jealousy, I hear ;-) ? Well Dart is fun. It is fun in its own niche. It is like Java for the web. Can have types. The IDE is a central point of development. Easy to get started for those who are perhaps average in their skill. Is designed to be familiar (curly brackets and simple syntax). It is not fun in the sense that Haskell, Erlang or LISP are fun. Oh look monadic isomorphic catamorphims with actor based concurrent meta-interpreters kind of stuff. So both fun but in different ways. Let's see how the shout example is fun in more detail. It shows the usage of a library. This is not a require.js hack, but a nicely built in facility. Also don't have to put everything in a class like in Java. The example also shows the usage of an anonymous function syntax. Those are fun and good for short callbacks. Not fun is in academically interesting but fun for practical use. It took Java decades to acquire those.
- snomad 13y agoI really like the feature set and feel of Dart. My only concern is lack of browser support. As of May 2013, Microsoft Internet Explorer, Mozilla Firefox, Opera Software's Opera browser, and Apple Safari have no plan to embed a separate Dart VM [1]. What would it take to get these vendors to add support? 1: http://en.wikipedia.org/wiki/Dart_%28programming_language%29#Browser_adoption http://en.wikipedia.org/wiki/Dart_%28programming_language%29...
- ahoge 13y agoThat shouldn't stop anyone. Dart works fine in every modern browser (and IE9), because you can compile it to JavaScript. Generating minified Dart code is one line and compiling to minified JS is also just one line. If you do one in your build script, you can also do the other. It's a no-brainer, really.
- spankalee 13y agoThey don't have to support it, Dart compiles to JavaScript.
- timothya 13y agoMy only concern is lack of browser support. Because Dart compiles to JavaScript (which can even perform better than handwritten JavaScript to perform the same actions[1]), it runs everywhere. You don't need the Dart VM built into a browser for your Dart application to work; it already works today. What would it take to get these vendors to add support? I think that likely they would want to see more applications written in Dart. If a big company (like Facebook, for example) wrote a large application in Dart, other browser vendors would see both that big name developers are using Dart for their applications and they'd see the performance boost that browsers with the Dart VM built in take advantage of[2]. This would make it more compelling for them to include a Dart VM in their browser. [1]: http://news.dartlang.org/2013/03/why-dart2js-produces-faster-javascript.html http://news.dartlang.org/2013/03/why-dart2js-produces-faster... [2]: http://dartlang.org/performance http://dartlang.org/performance
- ChuckMcM 13y agoThis I didn't get: "Dart is a source code VM The Dart VM reads and executes source code, which means there is no compile step between edit and run. As with other popular scripting languages, it’s very quick to iterate with Dart. The Dart VM runs on the command line and servers, and can be embedded into browsers. Just point the VM at Dart source code and you’re up and running!" By that definition Dartmouth BASIC is a "source code VM" aka an interpreter. Why call it something it isn't? I think Dart is interesting in its own way, and generally a useful exercise for thinking about how you might write an interpreted language that can run in untrusted contexts, but beyond that I don't "get" the problem it is trying to solve.
- rtfeldman 13y agoThe problem it's trying to solve is that Google's JavaScript optimizing team is hitting the limits of what they can do to speed the language up given the constraints imposed by JS. They want a replacement language that's more optimization-friendly so that they can continue pushing for faster Web clients. Given this creator goal, and most programmers' goals of "use a language that better suits my needs," it's not terribly surprising that Dart hasn't seen the kind of community interest that CoffeeScript has.
- spankalee 13y agoThat's not the only problem Dart is trying to solve. Productivity and the ability to build good tools for the language are huge factors in Dart's design. That's why it has libraries, type annotations, a declarative top-level structure, and some of the reason for closed objects. Good tools for Dart are _much_ easier to write than tools for a very dynamic language.
- ahoge 13y agoJust like V8, the Dart VM doesn't have an interpreter. The code is directly compiled to (fairly crude) machine code. Later, the hot parts are replaced with better machine code.
- mythz 13y agoCoffeeScript, TypeScript, GWT and every other language transpiling to JS gets hit with the compilation cost to first compile to JS (possibly waiting to emit source maps as well), after that point the browser can load and execute the compiled JavaScript. When developing and running in the DartVM, Dart code can run natively inside the Dartium browser without needing to compile to JS first. Also Dart is declaratively structured and optimized for fast start-up times (e.g. opts for lazy loading) which means they can start JIT'ing and executing from the main(){} entry point (which is also the point where snapshots are saved at).
- tnuc 13y agoDart is exactly the language that I think it is. It is too bad that it doesn't run on many browsers but that isn't going to change. What is the point of using Dart other than to join Google's garden of ugly walls?
- spankalee 13y agoDart runs on IE >= 9, Firefox, Safari and Chrome. Why is that "too bad"?
- LVB 13y agoThe JavaScript output runs on all of those browsers, but only Chrome (or actually the special "Dartium" version of Chrome) has a VM to run Dart code directly.
- spankalee 13y agoWhy does that matter? Dart brings improvements to the language and tools that are worthwhile regardless of the VM being available in the user's client. dart2js is the primary method of deploying Dart code, and there's nothing bad about that.
- pjmlp 13y agoIt does not bring any advantage to the plethora of languages that already compile down to JavaScript.
- mratzloff 13y agoWho is the audience for Dart? Clearly it is first and foremost Google, whose programmers spend their days writing Java and C++ in an IDE like Eclipse. But web developers, who are the primary producers of JavaScript, will happily stick with Node.js, CoffeeScript, or plain JavaScript. For that audience, they are given a language with optional static typing (most don't want it) and an Eclipse-based editor (most don't want it). By way of contrast, consider Go. Go is (in my opinion) an extremely successful successor to C, in terms of its design. It fixes a handful of problems with C (strings, and I would argue pointer arithmetic), and modernizes and streamlines it. The interface system is fantastic. In terms of its design, I have nothing but good things to say about Go. Dart does not seem to improve on JavaScript in a compelling way. It adds optional static typing, and as far as I can tell, nothing else. Is it any surprise that Dart has failed to take off?
- melling 13y agoDart isn't done. Most people aren't going to use it for real projects until it's at least 1.0. Furthermore, Dart really won't shine until its vm is built into Chrome.
- mythz 13y agoThe primary audience, is web developers. Dart is an ambitious attempt at simplyfing web development, reducing complexity and improving productivity which: - Provides a familiar language with clean semantics and low ceremony - Provides the fastest dev iteration times (there's no compile step, just edit + run in Dart VM/Dartium) - Provides ~10x faster start-up times with snapshots (Dart VM) - Provides faster run-time performance, that's predictable and can take advantage of real integers and SIMD instructions (VM Only) - Provides a unified object model so all classes from all libraries can interoperate - Providing a rich, well-defined, consistent API, real collections, removing JS WATs, smoothing over browser quirks - Provides a unified and composable IO model: Futures and Streams (repeating events) - Provides a new powerful way to develop client apps with Web UI (Dart WebComponents) offering unprecedented levels of encapsulation and reusability - Provides optimal dev and deployment options, you never have to worry about choosing the smallest libs as tree-shaking ensures only code used is compiled and minified - Providing "full-stack" dev environment, e.g. same language on client and server There are many initiatives ongoing to improve web development IMO Dart is the most radical and has the most potential to provide a productive web development environment in the visible future. I hope it extends further than that and is offered as a language choice on Android (which will make me switch to Android dev).
- mythz 13y agoFor those interested, a great place I've found in keeping up with Dart announcements and to get in touch with the Dart community is on Dart's G+ Google Group: http://g.co/dartisans http://g.co/dartisans
- uvtc 13y agoOne thing I'm not too crazy about is that, AFAICT, it seems that you need a Google account in order to upload packages to its cpan-alike, http://pub.dartlang.org/ http://pub.dartlang.org/ . Can the Dart package management tool fetch/install packages which are not hosted at pub.dartlang.org? Can it install packages straight from a github repo?
- xxgreg 13y agoThe pub package management tool allows you to fetch libraries from a git repo or the local filesystem, see here: http://pub.dartlang.org/doc/dependencies.html#git-packages http://pub.dartlang.org/doc/dependencies.html#git-packages
- deleted 13y ago[deleted]
- trimbo 13y agoI've read post after post about Dart. It looks really neat. I want to try it sometime. Now can Google use it to do something big and important? Please? We want to see that it works for you. Invest in it by building products with it and show us we should do the same.
- alvivi 13y agoSo, I've thought for a long time ... if I could take a clean sheet of paper and write [a new language] that retains all the goodness of [JavaScript] ... I would not have come up with anything like Dart. - Douglas Crockford
- DomreiRoam 13y agoI don't know Dart but I m intrigued by this "Dart is purely object oriented". Seems that people don't like some fundamental characteristics of javascript: the functional part and the prototyped based OO style. Is it still possible to use this in Dart or it is like the author said, purely OO?
- PommeDeTerre 13y agoSupporting first-class functions only makes a language "functional" in the smallest sense. Functional programming goes far beyond that. It encourages things such as immutability, referential transparency, powerful pattern matching, the heavy use of recursion, and robust type systems. JavaScript either does not support such techniques and concepts, or it makes them difficult to use. Thus it is improper to consider JavaScript a "functional" programming language. The same goes for JavaScript's so-called support for OO. Prototype-based OO is one of the least-useful approaches to begin with, for real-world software development, and JavaScript even manages to implement it quite badly compared to other languages offering prototype-based OO. JavaScript's complete lack of class-based OO (although, we may see this change with future revisions of the language) further suggests that it's wrong to call it an "object-oriented" language. I'm not sure we can even make this comparison. JavaScript is, at best, an imperative language that has tried, rather poorly, to partially incorporate concepts from more advanced programming language paradigms. It's hard to imagine Dart, or any other language, supporting more advanced concepts any worse than JavaScript already has.
- xxgreg 13y ago"Dart is purely object oriented" Languages such as Java and C# have a distinction between objects and primitives such as int and bool. In Dart all types are objects - even null! This is why Dart is pureOO. Dart has some of the classic higher order functions in it's core library - i.e. map, reduce etc. But it's not a functional language like Haskell.