

Why is Dart keeping certain cruft from other languages? - jarek-foksa
https://groups.google.com/a/dartlang.org/forum/#!topic/misc/8vfICVygruE

======
svachalek
Maybe I'm missing something big but Dart looks to me like Slightly Better
Java, yet another boring incremental improvement on languages that are well
past their sell-by date. There are plenty of more daring and yet more mature
alternatives that already provide the security of running on a Java or
Javascript VM (Scala, CoffeeScript, etc) so I'm really fuzzy on just what
they're trying to do here.

~~~
Raphael_Amiard
> CoffeeScript

How is coffeescript 'daring' in any way ? It is a thin veneer on top of
javascript, syntactic sugar for your coffee.

Dart is a hundred times more daring. It is trying to push optional typing. No
mainstream language has such a feature, and not even so much non-mainstream
ones.

It doesn't say anything about my opinion of any of those two languages (i
actually use and like CoffeeScript), but it just sounds to me like you're
looking at syntax only, where the important part of a language is its
semantics.

~~~
azakai
> How is coffeescript 'daring' in any way ? It is a thin veneer on top of
> javascript, syntactic sugar for your coffee.

CoffeeScript does compile into JS, but so does Dart. Both are in that sense
just syntactic sugar.

CoffeeScript does make quite big changes to syntax though (often inspired by
Ruby, Python, etc.) in many cases more than Dart which seems inspired by Java
- and I don't think anyone considers Java 'inspiring' (useful and familiar,
sure).

> Dart is a hundred times more daring. It is trying to push optional typing.
> No mainstream language has such a feature, and not even so much non-
> mainstream ones.

ActionScript.

~~~
Xcelerate
> CoffeeScript does compile into JS, but so does Dart. Both are in that sense
> just syntactic sugar.

With regards to Dart, that's like saying C++ is just syntactic sugar for
assembly. When there's semantic differences between the mapping from one
programming domain to another, I would argue that constitutes "compilation". I
would agree with the statement for CoffeeScript though.

~~~
azakai
This is a matter of degree.

Dart's types do not affect runtime behavior (at least in the compiled-JS
route), so basic types are quite close to JavaScript's, much like
CoffeeScript.

There are also no features in Dart that cannot be compiled into JS, like say
threading with shared state.

So overall I think it is reasonable to say that both Dart and CoffeeScript are
close to JavaScript and built specifically to compile into it.

~~~
skybrian
For the most part it's designed to be easy to compile to JavaScript, but there
are bizarre exceptions like support for arbitrary precision integers. (I
believe this is ignored by the Dart to JS compiler.)

~~~
sethladd
This is true, and a known bug:
<http://code.google.com/p/dart/issues/detail?id=1533>

------
pcwalton
These are all superficial syntactic complaints, following Wadler's law. My
experience is that every new language gets more than its fair share of these.

~~~
Xcelerate
<http://news.ycombinator.com/item?id=4516619>

~~~
Xcelerate
This shouldn't have been downvoted.

------
rogerbinns
One thing I would love to see in languages that can work with single or double
quotes is a practice like double quoted strings are text that will be
displayed to users and single quoted won't. That way editors and tools can
automatically help with localization, and can spot when you mix and match.

------
tdrd
I can feel myself getting dumber reading this discussion. Christoph Husse is a
donkey.

------
trotsky
when did it become so trendy to hate semicolons?

~~~
seanmcdirmid
A small but very vocal sub community of programmers hates semicolons. Really,
semicolons are nice for readability and nice for your tools, as they make
statement termination explicit. I was on the losing side (a semicolon lover)
of this debate when it came to scala.

~~~
icebraining
I think this is mostly bikeshedding, but I can't agree with your statement.

The claim is not that we shouldn't have explicit statement terminating
characters. It's that we already have one - new lines - and that mandating
semicolons is both redundant and bug prone.

Personally, and while it doesn't really affect my choice of languages, I think
you should be able to use one or the other, but not two consecutively.

In any case, excuse me for posting this, and I promise I won't discuss it here
any more.

~~~
AndrewDucker
I frequently split long statements over multiple lines for readability
purposes. Having an explicit statement terminator makes this possible.

~~~
mbell
I do this all the time in Groovy and don't use semicolons...

~~~
vorg
> I do this all the time in Groovy and don't use semicolons

Groovy's semicolon-less mode has lots of syntax restrictions. E.g.this doesn't
compile...

    
    
      println true
       ? "yes" : "no"

~~~
mbell
> Groovy's semicolon-less mode has lots of syntax restrictions. E.g.this
> doesn't compile...

I would't say 'lots'. It pretty much boils down to one thing: 'leave the
operator on the previous line'

println true ?

    
    
            "yes" :
    
            "no"
    

For example is just fine.

~~~
vorg
This compiles and runs OK in Java...

    
    
      class Hello{
        public static void main(String[] args){
          System.out.println( true
           ? "yes" : "no" );
        }
      }
    

In order to work without semicolons, Groovy's grammar must restrict some
things that work in Java. Semicolon-less mode in Groovy has a price.

~~~
JoeAltmaier
Ok, I've always wondered about that '?' operator. What's the point?

It was said (at the time) that C-like syntax meant a program was a series of
expression, not statements. So something like

    
    
       (void)1;
    

is valid syntax. Even compound expressions are valid:

    
    
       a=5, b=6;
    

Where I feel abandoned (betrayed?) is this: why then aren't compound
statements also expressions? E.g.

    
    
       {
       int x=Foo(50);
       Bar(x);
       }
    

The value returned could just be the value of the final executed expression
(Bar yields a value). No need for 'return' at all.

And no need for '?'.

    
    
       int x = { if (i > j) 5; else 6; }

~~~
vorg
You're right about statements being expressions and returning the last
executed expression. In fact, since using Clojure I've gotten used to these,
e.g.

    
    
      (-> (Foo 50) (Bar))
      (def x (if (> i j) 5 6))
    

I do miss the static typing and more readable syntax, though, and have
appreciated Haskell in this regard. Too bad things like powerful macros and
convenient syntax don't seem to gel together well in the same language.

------
goatslacker
Why does Dart look so boring? I'm just not buying that whole "familiarity"
argument. If a language is truly great then I'm sure people will learn how to
express their thoughts in that language.

I know syntax isn't everything in a language but it's pretty important. There
are much better (IMO) ways to express yourself than the approach Dart takes.

~~~
rdtsc
> Why does Dart look so boring?

So it appeals to the widest (and thus) more average programmer.

Languages have an implicit audience and purpose. For example I consider Java a
language designed to be consumed by code-monkeys. The mentality that you have
a large enterprise project and you look to India to hire 200 programmers to
finish it for you. The language has to have static typing, it has to be
familiar to those learning previous languages (C++, C), IDEs are the preferred
work environments, everything is very explicit and verbose.

Take Haskell, it is a language that would appeal to an academically minded
developer. Someone who knows about catamorphisms, uses words like endofunctor,
or say wouldn't mind struggling for weeks to comprehend what a Monad is.

Those are 2 different audiences. Neither language is better or worse, they are
just tools and in some cases one is a better fit, in other case another one
is.

Dart is closer to the Java.. It wants to be used in large code bases, by many
(including average and junior) programmers. So adding things like fancy list
comprehensions, de-structuring assignment, pattern matching and stuff like
that, might not fit with its goals.

------
Evbn
If code branches in the woods and no one is around to program it, does it
start a flamewar?

Does anyone use Dart?

