Hacker News new | past | comments | ask | show | jobs | submit login

> Let's remove the comments for a more visually fair comparison:

It was not meant to be unfair, I just took an existing example. If the Dart devs thought they needed the comments to make it clear what happens, then it's a decision I respect.

> Ok, you save a line.

Three.

> With text that says `x` and `y` are the fields. What about `xc` and `yc`, I thought those were the fields?

For standard classes, the compiler just does what you tell him:

If you write that you want a "val", you get an instance value, if you write a "var", you get an instance variable, if you write nothing (like in this case), you will usually get ... nothing.

That's perfectly clear in my book.

> Another thing I like about Dart is that the possible variations on the constructors fall into place, consistently:

In most languages, allowing a constructor which forgets to initialize things is considered a compiler/language bug.

(And having more than one constructor is pretty much considered to be an anti-pattern in Scala anyway.)

> Super call:

In Scala:

  class Person(val name: String) extends Animal



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: