Live data from Hacker News

"Hello World" in Dart, compiled to JavaScript

gist.github.com

101–110 of 162 posts

Re: "Hello World" in Dart, compiled to JavaScript

#101
post #72
post #65

Earlier quoted context omitted.

"...given that they should be grasping for any chance to leave the warty and dated pile of compromises that is Javascript behind..." I would not characterize the JavaScript community as desperate graspers, but even so, I don't see the virtue in grasping for the chance to replace a dated pile of compromises with a contemporary pile of compromises. All the hate is totally overblown - this project is young and will like…

Not desperate graspers? Try and count the number of libraries and frameworks that have come out in the last 5 years for JavaScript. Think of how many "to JS" solutions there are. Seriously, google that. Like 20? 25? How much "to C" solutions do you see getting on the front page of Hacker News these days? It's staggering how much 'grasping' has been happening compared to other ecosystems. It's ironic that people would…

Wow. What I'm seeing so far is the people critical being entirely reasonable (if perhaps misinformed), and the people defending Dart being positively hostile about it, calling "circle-jerk" left and right.

This post takes the cake in hostility, so far, though.

And what's it need defending for? Some people try to discuss the merits and flaws in a reasoned manner. The childish behaviour you speak of is entirely yours.

Re: "Hello World" in Dart, compiled to JavaScript

#102
post #58

Earlier quoted context omitted.

Same results: http://jsperf.com/dart-hello-world-test-with-optimize/2

Let's be realistic with ourselves here: is all that overhead ever going to compete with ten lines of "low level" (ha..) JavaScript? No. The problem here, and what is making us chuckle so much, is that the project as presented to us is not magical. For whatever reason, some of the brightest minds in our industry have not presented us (at this time) with a cross-compiler that is both robust enough to support large apps…

It is improbably in my mind that we've reached an age where javascript is considered low level -- even tongue in cheek.

I wonder where this is on the path to the singularity?

Re: "Hello World" in Dart, compiled to JavaScript

#103
post #25

As me1000 (Randy Luecke) says Dart is not meant for hello world. If you run this through closure-compiler it's reduced to 2000 lines which is nothing next to Underscore, jQuery, Dojo, etc. We all know the benefits of offloading code to a well known and well tested library or framework, especially if you're writing an app that is thousands of lines anyway. How is this contentious at the end of 2011 unless you're just…

> Circle jerks and knee-jerk reactions are for Reddit, not HN.

> Don't get me started on the whining

What is it with all the hostility from the people defending Dart? How about you display some of this expected HN behaviour yourself?

Re: "Hello World" in Dart, compiled to JavaScript

#104

Earlier quoted context omitted.

1. Not necessarily, as shown here, Google has a separate optimization step. If you look at the other posts you will see that using other google products, such as closure compiler/etc will make this all significantly smaller. This makes sense . Have the guys who know how to make JS small work on that problem, thus benefiting BOTH hand rolled JS code and Dart-compiled JS code. If not you are eternally having to do merg…

The "other tool" you mention reduces this to 2300 lines, and that's with the "remove unused code" option enabled. Still fails.

Damn... all the hello world programs I've written in dart just feel like such a waste now :[

SOMEBODY PLEASE RECOMMEND A GOOD HELLO WORLD LANGUAGE!!

Re: "Hello World" in Dart, compiled to JavaScript

#106

I'll repeat what I said in the GitHub thread: There's this interesting tool called Google Closure Compiler. It does dead code elimination. https://gist.github.com/1277285 Notice that this source is now 2000 lines of pretty printed JS. Given that anything interesting these days uses jQuery or Underscore.js clientside, and similar things serverside, this amount of JS for even Hello World is standard fare. EDIT: To be c…

If it's 2kloc for dead code eliminated "Hello World", how much would be left of that to eliminate when you actually write a program that does something?

Because I'm assuming once your program starts doing more complex things it'll actually need the rest of those 170kloc and be able to eliminate a lot less, right?

While if you make a complex program that uses basic jQuery, jQuery stays the same size.

Re: "Hello World" in Dart, compiled to JavaScript

#108
post #60

Earlier quoted context omitted.

http://jsperf.com/dart-hello-world-test-with-optimize/5 I moved things around so that what code does is roughly equivalent. As you can see Dart is slower, but the Dart runtime does not differ by a margin that matters for many applications - and note the size of the gap differs significantly between JS engines.

In all fairness, you removed the actual print function from the code. Inspection of the non-compiled source suggests that the entire function execution as shown in /2 is called for every call to Dart's print. print$getter()(1, $noargs, 'Hello, Dart!'); print$getter()(1, $noargs, 'foo'); print$getter()(1, $noargs, 'bar');

I did not remove print. Google Closure Compiler does inlining as well.

Re: "Hello World" in Dart, compiled to JavaScript

#109
post #64

So the joke is that a prototype of a whole separate language has to include its runtime in its cross-compiled output? Did people... think this wouldn't be the case? Do they think that Javascript is not thousands of lines of C/C++ lurking in your browser? Good joke guys, but I don't think you realize which way the punchline is pointing... It sort of amazes me that people are being so hard on Dart, given that they shou…

Amen. The "me too" culture that's going on w/r/t Dart is really disappointing. Google: "Hey everyone, let's make the browser better by switching to something that smells less like garbage than javascript." Community: "You forgot a semi-colon!" Shameful.

mate, it's not all that bad. people's reactions here will have pretty close to zero impact on the long term success or otherwise of Dart; programming languages are still much of a meritocracy

that said, wading in and telling people the things they like smell like garbage isn't the most effective way of getting them onside. If you're going to do that, then what you're selling better darn well blow their socks off, and Dart isn't doing that.

personally, I really enjoy writing js (and I have a growing love for coffeescript as well) and I don't feel Dart offers anything I need yet. I'll wait and see what happens

Re: "Hello World" in Dart, compiled to JavaScript

#110
post #58

Earlier quoted context omitted.

Same results: http://jsperf.com/dart-hello-world-test-with-optimize/2

Let's be realistic with ourselves here: is all that overhead ever going to compete with ten lines of "low level" (ha..) JavaScript? No. The problem here, and what is making us chuckle so much, is that the project as presented to us is not magical. For whatever reason, some of the brightest minds in our industry have not presented us (at this time) with a cross-compiler that is both robust enough to support large apps…

It makes me think that dart would be a perfect language in which to re-implement OpenDoc.
Post reply on HN