News for hackers. Stuff that matters.
Re:Dart is ready for the real world by cletus on Tuesday October 16, 2012 @07:22PM (#4662435)
Honestly I still don't see the point of Dart. It's made some strange choices (IMHO) like optional typing.

The idea that code can be shared between client and server is the panacea touted by GWT, which (IMHO) failed to eventuate (eg some classes weren't "GWT compatible" and this included protocol buffers generated classes). Dart seems like the next throw of the dice. I am not optimistic about its successes.

Go on the other hand, seems to have an incredibly bright future (IMHO) and it has lots of things in it that I like.

The only issue with Go, as a low-level (C++ replacement) language at least, is that it is a GC language. I used to think that you could implement some kind of ARC (automatic reference counting) system a la Obj-C/iOS 5+ as a middle ground between manual memory management and GC but I now have doubts about this, largely due to reference counting being an issue with locking on highly concurrent systems (something not an issue on phones with Obj-C/iOS).

More to the point, I think Javascript is like the email of programming languages: its ubiquitous and a whole bunch of people are convinced it needs fixing but I'm not exactly sure why. More to the point, those fixes seem to be incredibly complicated to the point of being a questionable value proposition.

I've been using AngularJS of late and to me it's a bit like the Lisp of Javascript frameworks in the sense that it is actually incredibly expressive but can have a steep learning curve. There is a lot that's simple about Angular but once you start delving into custom directives that support ngModel and the like you start requiring a deeper understanding of what's actually happening.

Anyway, back to Dart: I wish them the best but the complexity of language cross-compilation I think diminishes most if not all of the benefits of client and server language-sharing.

Re:Dart is ready for the real world by ahoge on Wednesday October 17, 2012 @01:14AM (#4663234)
>It's made some strange choices (IMHO) like optional typing.

Yes, this may look a bit weird, but it actually makes perfect sense. Those types are annotations. If you use them at the "API boundaries" (parameters and return values), you already get most of the benefits you may know from Java or C#.

Compare the doc comments you usually have to write with those baked-in type annotations:

    /**
     * Foos the bar.
     * @param {int} x
     * @param {int} y
     * @returns {String}
     */
    function foo (x, y) {
        ...
    }
vs

    /// Foos the bar.
    String foo (int x, int y) {
        ...
    }
Much better, isn't it?

Additionally, adding those type annotations is useful right off the bat. The IDE will make use of them right away.

>Go on the other hand [...]

Well, Go is very different. It has a completely different focus. It's more like Rust, for example.

Re:Dart is ready for the real world by riquito on Wednesday October 17, 2012 @05:13AM (#4663702)
You made an example of how not to write documentation and then you shown that the code was better without. That is not the point.

Try to add content to the documentation, as "what is expected to be x?", then you can't remove it so easily anymore

Re:Dart is ready for the real world by polux on Wednesday October 17, 2012 @06:28AM (#4663826)
The point is right now JS developers of big apps write this kind of comments because they are understood by tools like https://developers.google.com/closure/.
Re:Dart is ready for the real world by ahoge on Wednesday October 17, 2012 @10:37AM (#4664620)
> You made an example of how not to write documentation and then you shown that the code was better without.

Both code snippets are equally documented. That triple slash thing is a doc comment and the type annotations will be also used by dart doc.

Furthermore, those type annotations will be used by the IDE right away. It will tell me if I pass something of the wrong type or if I do something silly with the return value. That type information will be also shown in call tips. I can also run my stuff in checked mode during development, which will make sure that everything is used correctly.

That's the advantage of having this kind of annotations baked into the language itself. It's a lot less annoying to write and, since it's standardized, every tool can use this information, too.

Since this stuff is optional, you can gradually add them as you go. You can quickly prototype something and if it worked as intended, you can add some types while you clean it up.

Re:Dart is ready for the real world by TazeTSchnitzel on Wednesday October 17, 2012 @09:38AM (#4664318)
Um, I think that's a type annotation for closure compiler, not a documentation comment.
Re:Dart is ready for the real world by ahoge on Wednesday October 17, 2012 @04:21PM (#4666228)
The closure compiler uses doc comments.

YUIDoc or JSDoc comments look pretty similar, for example. However, since this stuff isn't standardized, there are some differences between different flavors.

Re:Dart is ready for the real world by orangethirty on Tuesday October 16, 2012 @08:05PM (#4662585)
I agree. Even though I'm not a JS fanboy, can't really be against the language at this point. It has evolved a very good community around it, and libraries like Jquery make it very simple to pick up. That just makes adoption of Dart less likely.
Re:Dart is ready for the real world by halefx on Tuesday October 16, 2012 @11:58PM (#4663091)
Dart was actually created by the guys who created V8. They gave a great interview about it in episodes 8[1] and 8.1[2] of Javascript Jabber.

1: http://javascriptjabber.com/008-jsj-v8-and-dart-with-lars-ba...

2: http://javascriptjabber.com/008-1-v8-and-v8-and-dart-with-la...

Re:Dart is ready for the real world by pcwalton on Tuesday October 16, 2012 @09:17PM (#4662794)
There are middle grounds between unsafe manual memory management and full garbage collection other than atomic reference counting. Region systems (like in Cyclone and Rust), for example.
Re:Dart is ready for the real world by kevingadd on Tuesday October 16, 2012 @10:16PM (#4662907)
You can also integrate unsafe manual memory management with a full garbage collector in environments like .NET. Use the GC for 99% of your code, manually malloc/free/pin the other 1%.
Re:Dart is ready for the real world by bigdubs on Wednesday October 17, 2012 @12:18AM (#4663132)
One of the more elegant ways of handling this, .net does a great job of integrating with unmanaged (COM, i'm looking at you) resources.