
Why Dart is not the language of the future. - vital101
http://blogs.perl.org/users/rafael_garcia-suarez/2011/10/why-dart-is-not-the-language-of-the-future.html
======
ohyes
There are a lot of unwarranted conclusions drawn here. I think this article is
FUD (and I don't really care for Dart).

> Dart programs may be statically checked. The static checker will report some
> violations of the type rules, but such violations do not abort compilation
> or preclude execution.

> In other words the "static checker" is a lint-type development aid, not a
> language feature.

My reading is that the language is optionally typed (similar to SBCL). The
type checker will warn you when you have a type declaration that appears to be
incorrect, and will optimized based on these declarations, but will not keep
you from running code that violates a type-check. This is a remarkably good
solution for dynamic languages.

> Here's a strange thing: the one and only true value is the boolean literal
> boolean true. Everything else is false. That means that code in if (1) { ...
> } will never execute, because 1 is a number, not a boolean, and there is no
> implicit conversion to boolean. You'll need to write if (1==1) instead.

This makes as much sense as 'everything' being true. You would write if (true)
{...}, but I can't imagine why you would do that.

> There is no implicit type conversion between numeric, string or boolean
> types.

Ok. This is a good thing. Auto conversion is bad.

> The distinction between string and numbers allows to re-use the addition
> operator + both for addition and concatenation. However, without strong
> typing, this will almost certainly prove to be a bad idea. From the specs,
> it looks like "2" + 2 will be a concatenation, and 2 + "2" a run-time
> exception (in the absence of implicit conversion from string to number), but
> experience infirms this: string concatenation happens in both cases
> (although with a warning in the second one).

This seems to directly contradict the first point. Which is it? It should do a
dynamic type check and generate a run time exception in both cases. I don't
see anything to convince me that "2" + 2 will be a concatenation... in the
spec.

>Thus, isolates are a heavyweight thread control model very much like Perl 5's
ithreads. That means that they are good for data isolation, but heavy to use
and hungry in memory, because spawning a new isolate will imply cloning all
the objects and data structures of the running libraries.

There is absolutely nothing that implies this. There is a tiny section in the
spec about isolates. They could easily be lightweight like Erlang processes.

~~~
seasoup
>> There is no implicit type conversion between numeric, string or boolean
types.

>Ok. This is a good thing. Auto conversion is bad.

One of the things I really dislike about developing in Ruby is that I can't do

value = 5 "The value is " + 5

I get bitten by this at least 10 times a day while developing, usually either
when dumping to the log, or writing into html. I can fix the problem really
quickly now, but every time I get an error:

"r" + 5 "TypeError: can't convert Fixnum into String"

I think, yes, yes you can easily convert a Fixnum into a String.

"r" + 5.to_s

It just means I have to sprinkle .to_s everywhere in my code. Ridiculous!

~~~
andrewcooke
please can you explain what

    
    
        value = 5 "The value is " + 5
    

is supposed to do? at the moment i can't work out why it would be frustrating
to be unable to type something that looks like a syntax error... (i'm assuming
it has some meaning in a language i don't know, which i guess would mean php).

edit: what does "say" mean in the reply below? print? evaluate? and does
"later" mean in another statement? or replacing what was before?

~~~
stickfigure
The problem is that his two lines of code got joined by HN's formatter (which
needs two newlines for a real line break). Presumably his desired message was:

value = 5

"The value is " + 5

------
alttag
I think one of the reasons JS succeeded is precisely a major complaint of
experienced developers: globals [1]. But this, (perhaps as with PHP) is what
enabled novice developers —some of whom eventually became experienced
developers—to learn the language easily.

We all started with some bad practices, and as we matured our code did too.
But the loose, forgiving standards are precisely what enabled broad use in the
first place.

When a language imposes more constraints on the programmer (it may be for
their own good!), it limits adoption and growth.

1: From the summary of _Javascript: The Good Parts_ , "... Douglas Crockford
identifies the abundance of good ideas that make JavaScript an outstanding
object-oriented programming language-ideas such as functions, loose typing,
dynamic objects, and an expressive object literal notation. Unfortunately,
these good ideas are mixed in with bad and downright awful ideas, like a
programming model based on global variables."

~~~
j_baker
I think there are very few who would say that globals shouldn't be allowed
altogether. The problem is that JS relies a bit too much on globals all being
crammed into one namespace.

I'm an advocate of the python model (although I should maybe call it the
Modula-3 model): only allow module-level globals. You get globals if you need
them, but no worries about code mangling your variables.

~~~
mmahemoff
This is what I like about CoffeeScript too. It wraps the module in a closure,
so globals are opt-in. By default, the variable will be scoped to the
generated module, but you can simply attach it to the global namespace
(window.foo=x in the case of a browser-side CS).

------
jriddycuz
_The worst of both worlds: Dart fails to provides the advantages of static
languages, without compensating by the flexibility of dynamic languages._

This was my impression exactly when I first read about Dart. This is the
language that Google wants to replace Javascript? Please. Javascript may have
some strange design quirks (or outright flaws, depending on who you talk to),
but at least it has the sense to have a meaningful boolean context. I
understand that you can't try to revolutionize everything if you're targeting
a wide audience, but this just looks like decaffeinated Java.

~~~
Nitramp
Meaningful boolean context? I understand that the original author is a Perl
programmer which probably means he has wildly different views of the world,
but seriously?

"Meaningful boolean context"s have given us things like the abundant "if
(!!foo)" in JavaScript. And then he goes on to criticize absence of auto-
conversions, which are the other plague of dynamic programming languages (see
"===" & friends).

I don't see how anyone could actually want that kind of litter in his
programming language.

------
bascule
This article conflates "dynamic typing" with "weak typing" all over the place.
First he whines that type declarations aren't mandatory (at least within the
scope of what a type inferencer can resolve), claims the runtime won't be able
to determine type information (which V8) can already do...

...then he goes on to complain that there's no automatic type coercion! This
is probably one of the worst misfeatures of JavaScript (and Perl and PHP), but
after a short tirade about "weak typing", he's longing for automatic type
coercion? Sorry dude, "3 dog night" + 2 should not equal 5

------
mrspeaker
Very interesting article. After playing with the examples and looking at the
docs for a bit, it really felt "old school" - but I assumed that that was just
a facade to lul any corporate java types into a false sense of familiarity
before busting out the modern goodness: much like JavaScript's own "Surprise!
I was really SmallTalk all along!" magic trick.

~~~
munificent
> "Surprise! I was really SmallTalk all along!"

Self, actually. Dart is closer to Smalltalk in Java's clothing.

------
dreamdu5t
Dart provides and enforces a bunch of idioms that you don't need in JavaScript
in the first place! Adding classes to a language that... doesn't need classes.

If anybody but Google released Dart HN wouldn't give two shits.

------
ajanuary
The comments under the "Feeble Typing" section make it clear the author has
never seen or read Gilad talk about optional typing. For one example, read
<http://bracha.org/pluggable-types.pdf>

------
enmanuelr
Yes, please. Tell me how this language, before it even launches, is finished,
or has been tested in the real world, is already doomed to fail.

Oh and it's posted on a Perl blog. Completely objective I'm sure.

------
jbooth
Is it just me, or is every dart criticism follow the pattern:

1) I have a hobby horse 2) Dart gets released 3) Flog hobby horse

Go had a bunch of similar criticisms, mostly for not being "innovative" enough
and favoring a small, solid feature set.

~~~
bad_user
I don't know why you speak in the past tense, but I consider Go still not
being "innovative" enough and also broken by design. We'll talk in about 2
years from now when they'll finally add generics to the language, in a broken
way nonetheless, as generics do have to be baked in right from the start to
pull it off. And it badly needs generics.

But you see, Go got all this attention just because it is a language released
by Google. And in the meantime version 2.0 of a real systems programming
language that is innovative and kick-ass is largely going unnoticed.

~~~
LeafStorm
> And in the meantime version 2.0 of a real systems programming language that
> is innovative and kick-ass is largely going unnoticed.

Which one?

~~~
malbs
I'd love an answer to that - I just got given the task to evaluate Go as a
possible development tool for a future project.

Edit: I'll take a stab in the dark and say D?

------
swah
Those points just mean Dart isn't revolutionary, which is pretty much a
requirement for a language to replace Javascript.

~~~
jinushaun
Syntactically, Dart looks a lot like ActionScript 3, which is basically
Javascript with classes. ECMA decided not to adopt Adobe's AS extensions into
ECMAScript 4 because they felt it was trying to turn Javascript into Java.
They wanted to maintain the "feeling" of coding Javascript. (Basically the
paradigm pioneered by jQuery)

~~~
mmatants
And I am _so_ glad they did. I remember feeling unsettled by JS's lack of
formal classes... and then I was enlightened.

~~~
jinushaun
I'm in the same boat. Back when I was a heavy AS3 developer, JS looked dumb
and gimped. But once I drank the JS Kool-Aid, I saw the value in how JS does
things. Not everything has to look and feel like Java. Now whenever I see
frameworks that force classes onto JS, I have to roll my eyes.

------
rayiner
Like 80% of these things are true for Scheme/Lisp/Dylan. Canonical true value?
Lack of implicit type conversions? These are good design decisions, not warts.

~~~
samth
In Scheme/Lisp/Dylan/Racket/Clojure/Your favorite lisp dialect everything
except #f is true -- Dart is the other way around.

~~~
rayiner
Right, it's the opposite convention from Lisp. I'm trying to distinguish from
say Perl, which doesn't have a canonical true or false value but identifies a
set of things that "seem like they should be false" like 0 and "".

------
sambeau
This is not a bad article despite the stupid title.

Take-up is all that matters in the future; the quality of a programming
language has rarely had any influence on take-up.

~~~
qntm
So what does influence take-up? And does Dart have it?

~~~
sambeau
I dunno, something like:

    
    
      * The backing of the largest web company in the world.
    

or

    
    
      * Inclusion in the second-most popular browser in the world.
    

Yep. That aught to do it.

~~~
guard-of-terra
VBScript had both (actually the browser was the most popular), and look how
far it went.

~~~
mdaniel
One can also argue that VBScript is not tooling-friendly. I am talking a
little out of school, since I have never had to use VB.net; it could be wholly
different. But I have had my fair share of VBScript interactions and those
were not fun (Microsoft-isms aside).

------
roopeshv
I'll just leave them here.
([http://www.google.com/search?q=chrome+why+we+don%27t+need+an...](http://www.google.com/search?q=chrome+why+we+don%27t+need+another+browser&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-
US:unofficial&client=firefox-a))

[http://www.uxpassion.com/2008/09/google-chrome-nah-we-
dont-n...](http://www.uxpassion.com/2008/09/google-chrome-nah-we-dont-need-
another-hero/)

[http://www.extremetech.com/computing/79620-who-cares-
about-g...](http://www.extremetech.com/computing/79620-who-cares-about-
googles-chrome-browser)

[http://floggingenglish.com/2008/09/03/google-chrome-just-
bec...](http://floggingenglish.com/2008/09/03/google-chrome-just-because-you-
can-doesnt-mean-you-should/)

------
aristidb
> Which means that the expression (a==a) might be, in some pathological cases,
> false.

Most languages (including Perl) have at least one case where a==a is not true.
(0.0/=0.0) == (0.0/0.0), or any NaN == NaN expression.

~~~
regularfry
That's less a language thing than it is an IEE754 float thing, as I'm sure
you're aware. It's justified there because it's a genuine propagation of an
"undefined" result. I'm not sure that is the sort of protocol user code should
be able to opt into by accident.

------
pyre

      > if (1) { ... } will never execute, because 1 is a
      > number, not a boolean,
    

This hasn't stopped Ruby from being popular.

~~~
scotth
I guess you mean the opposite hasn't prevented Ruby from being popular. All
numeric values are truthy, including 0.

~~~
pyre

      > I guess you mean the opposite hasn't
      > prevented Ruby from being popular.
    

I was stating something more like "the fact that there is a hard split between
numbers and booleans, and everything -- barring null -- by default evaluates
to true." Since everything is a object instance in Ruby, asserting a variable
is basically only evaluating whether or not it is null.

~~~
dlitz
null or false, actually.

~~~
pyre
Slip of the tongue. ;) But the easiest way to think about it is something
like:

    
    
      type(x) == Boolean ? x == True : x != nil
    

Disclaimer: That may not be valid Ruby, as I only have a passing knowledge of
some bits of Ruby.

------
bryze
If we're going to be posting judgmentally titled articles, then why don't we
post "why perl is the language of the past." I suspect the main reason
languages like perl and FORTRAN are still used is because of legacy and
tradition. But I acknowledge that is my opinion, not fact, so I wouldn't post
such a title. Seriouly, we need to stop the pomposity. What about "My concerns
about Dart 0.1", or "Early Criticism for Dart 0.1"?

------
digamber_kamat
I will not use dart because it comes from google. Wont let them own everything
about the web.

~~~
digamber_kamat
I will still not use dart!

------
dextorious
May I point to the irony on posting why a language is not "the language of the
future" on perl.org?

[UPDATE: yes, please, down vote freely, because humor is dangerous].

~~~
dillon
I personally don't find an irony. Perl may not be the most popular language
ever, but it definitely has its place. I do find an irony that the 0.1
specification of Perl is worst than the 0.1 specification of Dart.

~~~
chromatic
_I do find an irony that the 0.1 specification of Perl is worst than the 0.1
specification of Dart._

Why is it surprising that a language designed to occupy a niche between shell
and C in 1987 had a spec faster and looser than a language designed from
(let's say) 2009 through 2011, based on an existing, popular, and well-
understood language with well-publicized flaws?

------
dos1
To me Dart feels a bit like the Embrace/Extend/Extinguish behavior of
Microsoft. There's nothing I've seen so far that really makes me excited about
Dart, and it kind of feels like Google is really just creating this new thing
for the sake of being different. It seems like they want to unilaterally make
decisions on the future of the web. We all know how well that works.

------
sadfasdfads
The way I understand it, Dart is a higher-level abstraction of Javascript.
People thought that Java was crap too when it came out and said C/C++ was
still king. Look how that went.

Perl has been out fucking forever and still isn't in the browser, so stop
whining. Javascript whipped your ass in this arena, Perl.

~~~
sambeau
_"People thought that Java was crap too when it came out and said C/C++ was
still king"_

I was there in 1995 and I have no recollection of anyone saying that. People
were generally excited by its possibilities. The worry was about a) embedding
a VM into a browser back when memory was limited and b) java was controlled by
one company and wasn't an open standard.

Javascript won the 'browser war' because a) it was already there so it didn't
need a plugin b) it was 'good enough' for its time c) it had Java in the title
d) it had the sense to become an ECMA standard.

Perl never had any plans to be in the browser it was always a Unix command-
line tool.

What is interesting is that Java started as a language for making UIs on iPad-
like devices, The first web-server was written in Objective C, Perl gained
traction as the way CGI programs were written. Now, Objective-C is used for
programming iPads, Java moved from UI to Server and displaced Perl for
corporate web apps. Meanwhile Javascript has quietly solidified its role in
the browser and may finally make the leap to being a major server tech.

~~~
sadfasdfads
I was there in 1995, too. People were excited about the possibilities in Java
and applets, because that was the only purpose in the beginning as far as most
were concerned. Then people started writing UI apps in Java and starting to
write other standalone apps and it was deemed "slow" and people made fun of
it. People seem to forget that these days, because it wasn't long before it
took off and became popular.

"Perl never had any plans to be in the browser it was always a Unix command-
line tool."

Perl is not (just) a "Unix command-line tool". It is an interpreted language.
It was a preferred language for old school webapps in the mid-to-late 90s, and
continued in use a lot through the 2000s. Now for the majority, it has been
replaced, except for code that is still running on old servers.

So why are Perl programmers ranting against Dart? Javascript is somewhat of a
sore spot, even though the average Perl programmer would not admit to it and
may not even realize it. A client-heavy web application that doesn't try to do
things quickly saving keystrokes is about as far from Perl as one can get.
Dart is "Javascript part 2" to the Perl programmer, and subconsciousnessly
eats away at the Perl programmers ego. Even though they can't explain why,
they feel as they must destroy it.

