`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?
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.
+ alloc // reserves memory and creates an instance
- init // initializes the instance
- initWithSomething: // can have multiple initsWhy 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!
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 :-)
The world's experience outside of HN makes me think Dart will not be at all inhibited by its Java like syntax. If it doesn't catch on, it will be for other reasons.
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...)
With Source Mapping in browsers, it also means you'll be able to get a .coffee line in your tracebacks too.
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 symmetrySounds 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.
Where it shines IMHO is in the core library (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.
- 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. someString.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
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"?
That would have been an improvement right there.
Circle my_circle = new Circle();
I have to type the word circle 3 times to define a circle. It gets boring. This gets worse if you are trying to do any kind of user input. BufferedReader my_reader = new BufferedReader(new InputStreamReader(System.in));
Had to type reader 4 times. :(var c = new Circle();
"Visual Studio does it for me. I can see the point if you say it's longer to read but it's also much clearer,"
So he's saying that: Circle circle = new Circle() is typed by Visual Studio for you, and clearer to read. I don't think it's clearer to read.
I think "beauty" is really a subjective consideration when it comes to programming languages.
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:
Some notes: What?? Why to blur the concepts of classes with interfaces and introduce a quirk? Beauty comes from simplicity and symmetry. Mildly interesting. 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.