Live data from Hacker News

Learn Dart in 15 Minutes

learnxinyminutes.com

21–30 of 42 posts

Re: Learn Dart in 15 Minutes

#21
post #7
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) { ... }`

Implicit coercion is often a source of bugs. Some languages simply mandate that you be explicit about your intent. It can be slightly more verbose, but you gain clarity and reduce ambiguity. With implicit coercion, the programmer must mentally keep track of how values get coerced (are negative numbers truthy? are empty strings? empty lists? empty objects?). Different languages have different answers for all of these…

Being explicit is great, but it doesn't prevent a library from defining it's own boolean coercion rules.

The Angular team, for instance, has defined toBool() (which they use in directives like ng-if) like this:

    bool toBool(x) {
      if (x is bool) return x;
      if (x is num) return x != 0;
      return false;
    }
It treats true and non-zero numbers as true, and everything else (including null) as false.

Re: Learn Dart in 15 Minutes

#22
post #11

Earlier quoted context omitted.

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.

That's the real issue, IMO. It doesn't matter if Chrome has Dart as long as 2/3rd the market is using different browsers.

Re: Learn Dart in 15 Minutes

#23
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.

The VBScript comparison dig is as old as it is wrong.

VBScript was IE only, because VBScript didn't compile to JavaScript. Dart compiles to JavaScript and runs on IE, Safari, Chrome, Firefox and Opera. VBScript didn't have a specification accepted by any standards organizations, Dart is ratified as ECMA 408. VBScript is not open source, Dart is.

The fact that Dart has been used in production years before any VM in a browser should show how different they are.

Re: Learn Dart in 15 Minutes

#24
post #22

Earlier quoted context omitted.

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.

That's the real issue, IMO. It doesn't matter if Chrome has Dart as long as 2/3rd the market is using different browsers.

It's important to distinguish adopting a Dart VM from supporting Dart the language. Dart works fine in all modern browsers now by being compiled to JS. Doing that gives you the developer-time productivity boost of using Dart (which to me is the most compelling aspect of the language) while letting you ship your app to the entire web.

The VM is neat too, but from the user's perspective, it's an implementation detail. It's a really nice development tool, because it lets you run and debug your Dart code straight from source instead of trying to deal with generated code.

But I think it's relatively less important that the VM be shipped to end users. I think Dart can be a great, successful product without that happening.

Re: Learn Dart in 15 Minutes

#25
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.

The VBScript comparison dig is as old as it is wrong. VBScript was IE only, because VBScript didn't compile to JavaScript. Dart compiles to JavaScript and runs on IE, Safari, Chrome, Firefox and Opera. VBScript didn't have a specification accepted by any standards organizations, Dart is ratified as ECMA 408. VBScript is not open source, Dart is. The fact that Dart has been used in production years before any VM in a…

> Dart compiles to JavaScript

Not all language features can be represented in JavaScript.

Besides, all the languages that compile to JavaScript just add complexity layers to the already complex model of HTML/CSS/JavaScript.

And I bet there is a VbScript to JavaScript somewhere out there.

> Dart is ratified as ECMA 408. VBScript is not open source, Dart is.

Standards by themselves don't foster adoption.

Eiffel, Ada, Modula-2, Extended Pascal, Common Lisp, Smalltalk, ... have ISO/ANSI standards.

In the 60 - 90's being open source wasn't a requirement for multiple implementations for programming languages.

Re: Learn Dart in 15 Minutes

#26
There's an error in the section on literals. Literals used outside of classes do not have to be const. Not sure where that notion came from, but this is totally valid:

    var l = [];
Also, the example of looping over characters in a String using substring is very odd and expensive. Generally, if you want to iterate over a list of single-character Strings, you'd use String.split():

    for (var c in str.split('')) {}
split('') is necessary to be unicode safe. There's also String.codeUnits and String.runes (an iterable of code-points).

Re: Learn Dart in 15 Minutes

#27
post #25

Earlier quoted context omitted.

The VBScript comparison dig is as old as it is wrong. VBScript was IE only, because VBScript didn't compile to JavaScript. Dart compiles to JavaScript and runs on IE, Safari, Chrome, Firefox and Opera. VBScript didn't have a specification accepted by any standards organizations, Dart is ratified as ECMA 408. VBScript is not open source, Dart is. The fact that Dart has been used in production years before any VM in a…

> Dart compiles to JavaScript Not all language features can be represented in JavaScript. Besides, all the languages that compile to JavaScript just add complexity layers to the already complex model of HTML/CSS/JavaScript. And I bet there is a VbScript to JavaScript somewhere out there. > Dart is ratified as ECMA 408. VBScript is not open source, Dart is. Standards by themselves don't foster adoption. Eiffel, Ada, M…

Context: I'm using Dart for app development for two years now.

> Not all language features can be represented in JavaScript.

I could not name one (except the dart:io stuff, which is not supported in the JS world). Could you please elaborate?

> Besides, all the languages that compile to JavaScript just add complexity layers to the already complex model of HTML/CSS/JavaScript.

I've found the same, but Dart is a surprising exception. If you are not using any fancy framework (e.g. Angular.Dart), you will be just fine with the close-to-the-browser approach of the language and APIs.

Re: Learn Dart in 15 Minutes

#28
It seems to me that the majority of the time learning any new language is not the syntax itself, but memorizing function names and parameter order. Has there ever been an effort to design a family of languages which use the same function names and order of parameters for the same operation so that switching between them would be a matter of learning basic syntax?

Re: Learn Dart in 15 Minutes

#29
post #25

Earlier quoted context omitted.

The VBScript comparison dig is as old as it is wrong. VBScript was IE only, because VBScript didn't compile to JavaScript. Dart compiles to JavaScript and runs on IE, Safari, Chrome, Firefox and Opera. VBScript didn't have a specification accepted by any standards organizations, Dart is ratified as ECMA 408. VBScript is not open source, Dart is. The fact that Dart has been used in production years before any VM in a…

> Dart compiles to JavaScript Not all language features can be represented in JavaScript. Besides, all the languages that compile to JavaScript just add complexity layers to the already complex model of HTML/CSS/JavaScript. And I bet there is a VbScript to JavaScript somewhere out there. > Dart is ratified as ECMA 408. VBScript is not open source, Dart is. Standards by themselves don't foster adoption. Eiffel, Ada, M…

>Besides, all the languages that compile to JavaScript just add complexity layers to the already complex model of HTML/CSS/JavaS

Does it? Because HTML/CSS/JS development is a bit of mess to begin with (and complexity rises when you start adding micro-frameworks into the mix - and you kinda have to if your codebase gets to be a decent size). I've done some Dart web-development, and it's cleaner and nicer.

Re: Learn Dart in 15 Minutes

#30
This has got to be the worst learn x in y minutes that I've ever read. Whitespaces, anyone? Every example is compacted and very hard to read. Comments should document each line instead of a huge wall of text before the function.

Naming everything ExampleX is very difficult to see what is being talked about in this particular function.

I'm lucky to know enough about Dart already, because this is a very bad representation of it, IMO.

Post reply on HN