Live data from Hacker News

"Hello World" in Dart, compiled to JavaScript

gist.github.com

41–50 of 162 posts

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

#42
post #37

Earlier quoted context omitted.

This is false. It is like claiming that it "should" really compile to just console.log("Hello,Darter!"); They're functionally equivalent so why not right? Dart was designed for big apps. Google is not aiming at optimizing all the Hello World pages. Every single framework in existence has terrible size characteristics for Hello, World. Loading all of Foundation and UIKit for showing Hello World on the screen in iOS? I…

Well, Dart is designed to replace JavaScript as the client side Web scripting language of choice. Given that goal, they need to do well at small projects as well as large ones.

If Dart ever replaced JavaScript then most code would probably be running under the native implementation and this issue would be moot. I think its acceptable for them to be focusing on the actual problems on the web (writing large maintainable applications), and not focusing too much on image swaps and console logs.

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

#45
post #22

Funny. But to be fair, a Hello World in C compiles to a 27k binary. Yeah yeah, optimize this, leave out that and you can get it smaller. Still doesn't change the fact that Hello World is not the target use-case for either C or Dart. Dart is intended for very large applications (compared to JS), so the additional weight for includes isn't that big of a deal. It also doesn't change the fact that Dart sucks. For other r…

hbgh

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

#46
post #18
post #4

I wonder if the only speed benefits that the Dart VM gives would be able to be beaten out by a smart compiler. I know this is early for the cross-compilation code (it doesn't trim out anything it doesn't need here), but I hope this isn't what is ultimately used in that comparison.

As I understand it, dart isn't trying to be a faster javascript. Its trying to be a better GWT. Many googlers I've spoken to firmly believe that you need a strongly typed, OO language with good tooling to be able to develop any large application. They believe web apps are no exception. Google has worked hard adding types to javascript with the closure compiler. But, there are limits to what you can achieve using java…

dart isn't trying to be a faster javascript.

It isn't trying to be a javascript, but it's certainly trying to be faster. Performance features prominently in every statement of their design goals. Not only that, but performance in all modern browsers - i.e. including the ones they don't control and won't ship with a Dart VM. I don't see how they can possibly pull that off. Can anybody?

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

#48

same code in coffeescript (@ preceding testMain makes it a static method and it looks like print in Dart converts to console.log) class HelloCoffeeTest @testMain: -> console.log "Hello, Coffee!" HelloCoffeeTest.testMain() resulting js var HelloCoffeeTest; HelloCoffeeTest = (function() { function HelloCoffeeTest() {} HelloCoffeeTest.testMain = function() { return console.log("Hello, Coffee!"); }; return HelloCoffeeTes…

Does CoffeeScript have all these data structures, http://www.dartlang.org/docs/api/index.html ?

That's a long list, so probably not. Does Dart have an existential operator?[0]

    zip = lottery.drawWinner?().address?.zipcode
Hey look, I know they're not really comparable. They're solving different problems, are at different stages in maturity and have a different philosophy on how to do things. I also think that Hello World is probably the worst way to compare any two languages, but it's a fun exercise anyway

[0] example code from http://jashkenas.github.com/coffee-script

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

#49

same code in coffeescript (@ preceding testMain makes it a static method and it looks like print in Dart converts to console.log) class HelloCoffeeTest @testMain: -> console.log "Hello, Coffee!" HelloCoffeeTest.testMain() resulting js var HelloCoffeeTest; HelloCoffeeTest = (function() { function HelloCoffeeTest() {} HelloCoffeeTest.testMain = function() { return console.log("Hello, Coffee!"); }; return HelloCoffeeTes…

CoffeeScript is meant to be synaptic sugar on top of JS. Dart is a language with different semantics that happens to compile to JS. As such it includes a lot of runtime code. More appropriate examples would be Emscripten, Parenscript, or ClojureScript.

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

#50

I don't understand why Dart is supposed to be good, someone please explain it to me like I'm an eight-year-old

It's not right now. It's a lousy CoffeeScript. The thing that makes dart good is that it could, some day, have it's own runtime. Also, the language is being designed by the team that did v8. So I'd imagine they plan to build support into chrome at some point.

I agree CoffeeScript has nicer syntax, but it retains all of Javascript's semantic warts. Whatever quibbles you might have about Dart's syntax (it's young yet!) it's semantics are much nicer than Javascript.
Post reply on HN