7 ms·
Agree with parent comment. My opinion, so far: Overall: uninspired. Below what I was expecting. Probably good for Google goals (tooling, migrating developers,
by nzonbi 15y ago
Agree with parent comment. My opinion, so far:
Overall: uninspired. Below what I was expecting. Probably good for Google goals (tooling, migrating developers, etc)
The language is somewhat interesting, but unfortunately saddened by an incredibly boring syntax. At this point, I am thinking that they would have been better off just going with the Go language for this.
Looks like something good to migrate fleets of java engineers to, but not something that would inspire "hackers".
Now I feel like it is not worth to create any "brigthly" IDE whatsoever. Just go with eclipse.
I was planning to immediately rush to the language. But changed to wait and see now.
Misses:
- Incredibly uninspired, boring Java-like syntax.
- Not everything is an expression.
- Java-like classes, instead of anything more interesting.
- Lacks simplicity, symmetry and beauty.
- Semicolons.
Some notes:
In Dart, you can often create objects directly from an interface,
instead of having to find a class that implements that interface
What?? Why to blur the concepts of classes with interfaces and introduce a quirk? Beauty comes from simplicity and symmetry.
named constructors:
var greeter = new Greeter.withPrefix('Howdy,');
Mildly interesting.
Every type in Dart is public unless its name starts
with an underscore ("_")
I laughed at this. I always have hated the practice to start with "_" for supposed private variables, in languages without true private. I like it this way in Dart. My little favorite syntax feature until now.
- haasted 15y agoIn Dart, you can often create objects directly from an interface, instead of having to find a class that implements that interface What?? Why to blur the concepts of classes with interfaces and introduce a quirk? Beauty comes from simplicity and symmetry Sounds like Java's anonymous classes. Quite a useful feature, actually.
- calebmpeterson 15y agoSounds like Java's anonymous classes. Quite a useful feature, actually. It's only useful because Java lacks first class functions and syntax for lambdas. This is the single most irritating thing about Java to me. When this is fixed with the release of 8, the only thing Java will be missing is a really good implementation of persistent data structures a la Clojure.
- iaskwhy 15y agoWhat does "boring Java-like syntax" mean? Can anyone show some quick examples of a boring and a not boring syntax?
- nailer 15y agoRequiring a function for a simple print statement, perhaps? The demo breaks when you remove the surrounding main() loop.
- cubicle67 15y agosomeString.append(System.getProperty("line.separator")); vs some_string += "\n" Edit: Someone's in disagreement with me, so I'll try and clarify. I'd classify boring code as code where the intent gets lost in the syntax/language or other constructs the maintainer of the code doesn't care about but are required anyway. Trying to open and read a file in Java is probably a better example as the intent (open this file and read the contents) is buried in about 6 lines of boilerplate code I use Java as an example because in a previous life I used to write it and see this as perfectly acceptable
- dextorious 15y agoWell, for one you can probably make your own "+=" for strings, if not available, since Dart has operator overloading. Also, System.getProperty("line.separator") does not translate to n"\n". The first makes your program more portable. Of course it could be made accesible easier, eg as a constant System.NEWLINE or something. [UPDATE] Downvote? Really? Because someone thinks "\n" is the same as "line.separator"?
- nmcfarl 15y agoOf course they could have taken perl's tact and defined "\n" to mean System.NEWLINE not 0x0A. That would have been an improvement right there.
- jeltz 15y agoIndeed they do not translate into the same thing. But neither makes your program more or less portable in itself. It all depends on what you want to use it for. Some files and protocols should always have \n some always \r\n while in some cases it should be the system line separator. I think Python, Perl, C, and Ruby have fixed that quite well by making the IO library do the conversions. I do not remember if it is the same in Java.
- cromwellian 15y agoDefault interface implementations are nothing new. In Scala for example, if you create a Map, you can get it to automatically construct a MapImpl, without having to know it. A really common case in many code bases is 1 implementing class, and 1 mock/testing class, and this fits the common case really well. I think "beauty" is really a subjective consideration when it comes to programming languages.
- arctangent 15y agoI agree with you about the syntax - I was hoping for something more like Python. Perhaps this is by design, though? Presumably the syntax doesn't look too bad to people who spend all day writing JavaScript (i.e. the target demographic for this language). Presumably some bright spark will eventually write a Python-to-Dart compiler and then we'll all be happy :-)
- rdtsc 15y ago> I was hoping for something more like Python. Me too! We already have a very readable, simple and elegant language, let's use that. Anyone know why that wouldn't have worked? (Not using the current CPython implementation but maybe the same syntax but with a different (web-only) set of libraries, that is...)
- nailer 15y agoThat's almost exactly what coffeescript is. With Source Mapping in browsers, it also means you'll be able to get a .coffee line in your tracebacks too.
- rdtsc 15y agoI agree. Yes, I would have liked to just have coffeescript as their new language. Maybe they could have just supported direct native execution on Chrome. Maybe Firefox would have followed.
- LeafStorm 15y agoCoffeeScript solves most of the problems with JavaScript's syntax, but the problem they're trying to solve here isn't the syntax, it's the structure and semantics.
- rayiner 15y agoBecause Python's semantics are fucktarded.
- 15y ago
- jmtame 15y agoAlso, string interpolation using only double quotes has bothered me in Rails. That was the one feature I saw that they supported, although now that I think about it, Rails probably adopted it as a convention to prevent excessive escaping.
- jeltz 15y agoI believe this interpolation difference in Ruby originates from Perl which in turn got it from bash and other UNIX shells. I actually like the fact that Ruby and Perl have so many way to quote a string a lot since I have always hated excessive escaping.
- manveru 15y agoThat's Ruby, not Rails. It allows you to influence how your content should be escaped, so you write '\n' instead of "\\n" and '"' instead of "\"", it's actually pretty handy in practice.
- phillmv 15y agoCan someone explain to me what's the point of having syntax like: `var foo = new Bar()`? Why can't a constructor just be a regular method that happens to return a new instance? What's with this new nonsense?
- tomp 15y agoI agree, this syntax makes little sense in dynamic languages where classes/types are first-class values that share the namespace with functions and ordinary values... Even in JavaScript, where it sort-of-kind-of makes sense, it introduces more problems than it solves.
- Someone 15y agoNitpick: you can make a constructor look like a regular method that happens to return a new instance, but you cannot make it one. How would that constructor make the instance that it returns? I think the overhead of adding that 'new' is worth it. Without it: in var foo = Bar(), is Bar a type or a function? If you decide it should be colored like a type, your syntax colorer needs deeper information about the code, making it harder to write, slower, etc.
- phillmv 15y ago>but you cannot make it one Why not? It makes no difference whatsoever. Make it so that the only constructor in the system is Object.new(), and so everything else that inherits behaves just like a method. >Without it: in var foo = Bar(), is Bar a type or a function? That's easy. Make it so that only classes and consts can be capitalized. Blammo!
- SeoxyS 15y agoNot true, look at Objective-C for an example of how it's done. Broken up into two methods, the first of which is a static method which creates an uninitialized instance, and the second which is a plain method which initializes the instance and returns self (or rarely, nil): + alloc // reserves memory and creates an instance - init // initializes the instance - initWithSomething: // can have multiple inits
- nathanwdavis 15y agoI agree that the syntax and semantics are uninspiring (you could say the same about Scala). Where it shines IMHO is in the core library (http://www.dartlang.org/docs/api/index.html http://www.dartlang.org/docs/api/index.html). Look there and you will find some interesting classes that deal with concurrency and asynchronous operations (Isolate, ReceivePort, Promise<T>). Also, unlike standard Javascript, there are collection classes for specific use cases (like Queue, Set, LinkedHashMap). This is where it is superior to both Javascript and mainstream static typed languages like Java.
- mrb 15y ago- Incredibly uninspired, boring Java-like syntax. Syntax should be boring. It should not deviate from one's expectations. One should not spend any mental resource thinking about it.