4 ms·
> Dart appears to be reasonably competent and technically sound Really? I got exactly the opposite impression. All types are nullable (lack of null safety). W
by tomp 15y ago
> Dart appears to be reasonably competent and technically sound
Really? I got exactly the opposite impression.
All types are nullable (lack of null safety). Why are they using a type (String) for a constant (''final'' variable)? Mixing up lists and arrays. There is a separate string builder class ''StringBuffer'' (which does not share the interface with ''String'', I don't know why not, while ''int'' and ''double'' are unified under the interface ''num'') that doesn't really work. You can't iterate over maps using the ''for...in'' syntax (at least the overview does not mention it).
This document, to me, screams of technical incompetency, or at least of language design from 10 years ago.
There are also some other weird design choices, like optional non-typing (i.e. there are no safety guarantees, types are not enforced), all values but ''true'' are ''false'' (this feature might turn out to actually be useful, but as far as I understand, they want to force people to write proper boolean tests in if statements - why then even allow non-boolean values in boolean contexts?). The ''[x = 1]'' syntax for parameters with default value is really weird, I guess its purpose is to be consistent with the optional argument syntax, but why not just copy what Python does, with all parameters with default values be optional, and you can always set it to ''null'' yourself, if you want...
Julia, for me, is a recent language that is really well designed!
- kibwen 15y agoI said "ignoring the type system for the moment" specifically because I wanted to exclude the type system from the following observation, since I don't have the type-theoretical background necessary to make a proper critique (and people far more intelligent than me have already bemoaned it[1]). I agree that Dart's features seem sort of "stale" (or perhaps "safe" would be a less inflammatory word). Language design from 10 years ago indeed, although it's still a young language, so I'm willing to give it time to evolve. In my defense, "reasonably competent" wasn't exactly intended as praise. I do have issues with the things presented in the overview, but at the time I wrote that comment there were no other comments on this article, and I felt that I'd be wasting my time by enumerating them. :P [1] http://lambda-the-ultimate.org/node/4377 http://lambda-the-ultimate.org/node/4377
- dchest 15y agoWhy are they using a type (String) for a constant (''final'' variable)? It's not a constant. Is a variable that contains a value of string type that cannot be assigned to anymore. "String" is an annotation for variable, not for the value. There is a separate string builder class ''StringBuffer'' (which does not share the interface with ''String'', I don't know why not, Because string values are immutable, they can't be concatenated without lots of allocations. StringBuffer solves this. This document, to me, screams of technical incompetency, or at least of language design from 10 years ago. This is probably because you didn't think out the various trade-offs and design decisions, of which Dart creators thought.
- tomp 15y ago> This is probably because you didn't think out the various trade-offs and design decisions I did, I just didn't want to write too many reasons, just a short rant... > It's not a constant. A variable that can only be assigned when it is declared, is not a constant? I think there's a fundamental disagreement in our life philosophies that can not be resolved through debate... ;) > string values are immutable, they can't be concatenated without lots of allocations A much more elegant approach that solves most string concatenation problems is string interpolation, which Dart has. There are legitimate uses of StringBuffer, but I'm not sure why they need to mention it in a Language Tutorial. However, my real complaint is not that. They took the time to put int and double under a common interface, num. So, why not put concrete string and StringBuffer under a common interface, called string, and also have StringBuffer implement a monoid interface (for the + and * operations). Edit: I hope this doesn't come off as rude. Just tried to clarify my original points.
- dchest 15y agoA variable that can only be assigned when it is declared, is not a constant? main() { final v = [1, 2, 3]; print(v.length); // => 3 v.add(4); print(v.length); // => 4 } There are constant expressions (and values) in Dart, though. For example, you cannot assign a mutable list (array) to 'final v' at the top-level, because it's not constant. However, my real complaint is not that. They took the time to put int and double under a common interface, num. So, why not put concrete string and StringBuffer under a common interface, called string, and also have StringBuffer implement a monoid interface (for the + and operations).* Then what happens when you want it as a key in the map? Really, string buffers and strings are different concepts. Even Ruby, with its mutable strings, has StringIO. Edit: I hope this doesn't come off as rude. Just tried to clarify my original points. Of course not, we're having a great discussion.