Live data from Hacker News

Learn Dart in 15 Minutes

learnxinyminutes.com

11–20 of 42 posts

Re: Learn Dart in 15 Minutes

#11
post #2

I love Dart, I think it's a great language. I hope that Google will start supporting it natively in Chrome.

What's the status on other browsers implementing it? Is it even a possibility?

Re: Learn Dart in 15 Minutes

#12
post #4
post #2

I love Dart, I think it's a great language. I hope that Google will start supporting it natively in Chrome.

They are. Check "In Development" section. http://www.chromestatus.com/features/6682831673622528 So in a few months we will have Google's VbScript available in Chrome.

I don't think you can infer any particular schedule from that page. Dart's been in development for a long time.

Re: Learn Dart in 15 Minutes

#13
post #9
post #6

This seems rather odd from example 14: // Boolean expressions need to resolve to either true or false, as no // implicit conversions are supported. I'm sure they have good reason for this, does anyone know of the rationale? I think I'd miss patterns like `if (arr.length) { ... }`

I think this is wrong or at least misleading. According to the Ecma standard: Boolean conversion maps any object o into a boolean. Boolean conversion is defined by the function application (bool v){ assert(v != null); return identical(v, true); }(o)

Reading your quote from the ECMA standard, "no implicit conversions are supported" may be wrong but at the same time not generally misleading. That is, that function errors on null values and returns false for anything that isn't identical to true, so while it does provide a conversion to boolean from any non-null value, anything that isn't exactly a boolean "true" (unless I misunderstand what "identical" does) is going to return false on conversion. This is consistent with other writings on booleans in Dart [1]. So it appears that Dart has implicit boolean conversions, but it converts everything that is not the single "true" value to false, so using an expression that never can evaluate exactly to boolean true in a conditional (unless you mean it to be a wordy way to create unreachable code) is never something you want to do.

[1] http://blog.sethladd.com/2012/02/booleans-in-dart.html "The only value that is true is the boolean value true. [...] In a boolean context, everything that is not true is converted to false."

Re: Learn Dart in 15 Minutes

#14
post #6

This seems rather odd from example 14: // Boolean expressions need to resolve to either true or false, as no // implicit conversions are supported. I'm sure they have good reason for this, does anyone know of the rationale? I think I'd miss patterns like `if (arr.length) { ... }`

This is true in Go as well http://play.golang.org/p/Mk6i0Ll8uW

I rather like that you're forced to be explicit. Often, the (hidden) conversion is a source of bugs or confusion.

Re: Learn Dart in 15 Minutes

#15
post #4
post #2

I love Dart, I think it's a great language. I hope that Google will start supporting it natively in Chrome.

They are. Check "In Development" section. http://www.chromestatus.com/features/6682831673622528 So in a few months we will have Google's VbScript available in Chrome.

I don't get why people make this VbScript comparison (sneer, actually). Yes, it is a language introduced by a single company, but then again many languages have started that way, and in this particular case there are big differences between VbScript and Dart. I think Dart is a better language. Do you disagree?

Re: Learn Dart in 15 Minutes

#16
post #9
post #6

This seems rather odd from example 14: // Boolean expressions need to resolve to either true or false, as no // implicit conversions are supported. I'm sure they have good reason for this, does anyone know of the rationale? I think I'd miss patterns like `if (arr.length) { ... }`

I think this is wrong or at least misleading. According to the Ecma standard: Boolean conversion maps any object o into a boolean. Boolean conversion is defined by the function application (bool v){ assert(v != null); return identical(v, true); }(o)

It's subtle. The conversion rule states that only `true` is true, `null` is an error, and everything else is false. However, the type annotation of `bool` means that in checked mode any non-bool value will cause a type error to be thrown.

The reason it's defined this way is for efficient compilation to JavaScript. Control-flow constructs don't have to perform a type-check, just a null check (which can be left out in cases due to null propagation).

Re: Learn Dart in 15 Minutes

#17
post #11
post #2

I love Dart, I think it's a great language. I hope that Google will start supporting it natively in Chrome.

What's the status on other browsers implementing it? Is it even a possibility?

It doesn't look good. It's very well possible, but the other parties just do not seem interested. Maybe because they are currently investing in Javascript related technologies.

Re: Learn Dart in 15 Minutes

#18
post #4

Earlier quoted context omitted.

They are. Check "In Development" section. http://www.chromestatus.com/features/6682831673622528 So in a few months we will have Google's VbScript available in Chrome.

I don't get why people make this VbScript comparison (sneer, actually). Yes, it is a language introduced by a single company, but then again many languages have started that way, and in this particular case there are big differences between VbScript and Dart. I think Dart is a better language. Do you disagree?

> Yes, it is a language introduced by a single company, but then again many languages have started that way

Including JavaScript.

Acceptance as a standard usually happens after someone implements it, makes it widely available, and proves its merit, not the other way around (and standards that happen the other way around tend to be dead on the vine.)

Re: Learn Dart in 15 Minutes

#20
post #6

This seems rather odd from example 14: // Boolean expressions need to resolve to either true or false, as no // implicit conversions are supported. I'm sure they have good reason for this, does anyone know of the rationale? I think I'd miss patterns like `if (arr.length) { ... }`

Are you really worried about having to type 2 characters ('>0') more? I think people are too worried about syntax when it comes to programming languages. I guess it makes sense because that is what is most obvious when you look at a language for the first time.
Post reply on HN