3 ms·
It already is - you just have to run in checked mode.
by kkowalczyk 14y ago
It already is - you just have to run in checked mode.
- damncabbage 14y agoIs that compile-time or run-time? If it's run-time, do you need to traverse all your code paths to make sure it's really really right? (I'm genuinely curious.)
- numbsafari 14y agoI have to admit, there's some part of me that wants to think that "types as documentation" is a good idea. But I have to go with the OP on this one... I watched the Dart presentation from Lang.NEXT and laughed a bit to myself at one point because even in the presenter's example, the "type documentation" was already outdated. During his presentation it doesn't matter, because everyone watching is in the context of the code as part of his discussion. But if you put that code in front of somebody a year from now, out of context, would they immediately pick up on it? Or will they be frustrated by the fact that they expect the types to be what they say they are, but they aren't? Are people really going to run in checked mode to verify their code? Or they going to do what they do with compiler warnings and turn them off as soon as they see one? I'm sure there will be a million blog posts titled "Dart Best Practices" that will say "do not use checked mode, it slows down execution and prints confusing messages". Of course, any bugs in checked mode will mean people will need to get their production systems working by ignoring checked mode. I guess... my gut tells me that you should either have types, or not have types. Being in the middle creates too many opportunities for cognitive dissonance, too many opportunities for sneaky bugs, and too many opportunities to keep having this debate. It's one of those things that seems really smart and cool that, on a practical level, will probably turn out to be a complete waste of time and a total distraction.
- ExpiredLink 14y agoA Quick Tour of Dart. Presented by Gilad Bracha Summary Gilad Bracha discusses Dart, its type system, interfaces, generics, ADTs without types, built-in factory support. http://www.infoq.com/presentations/A-Quick-Tour-of-Dart http://www.infoq.com/presentations/A-Quick-Tour-of-Dart
- stcredzero 14y agoeven in the presenter's example, the "type documentation" was already outdated. Yes, but it's not the same as outdated comments. A well featured optional type system will let you know that is happening. An out of date comment will just continue to deceive. Or they going to do what they do with compiler warnings and turn them off as soon as they see one? My advice, is not to work in such shops. I guess... my gut tells me that you should either have types, or not have types. Being in the middle creates too many opportunities for cognitive dissonance As if there's a lack of them on the ends of the spectrum compared to the middle. We will find out if it will be more of a mess, so many will have gut-calibration data.
- nl 14y agoI guess... my gut tells me that you should either have types, or not have types. Being in the middle creates too many opportunities for cognitive dissonance, too many opportunities for sneaky bugs, and too many opportunities to keep having this debate. It's one of those things that seems really smart and cool that, on a practical level, will probably turn out to be a complete waste of time and a total distraction. The worlds collective programming experience doesn't really back that up. Almost every language drops (or makes optional) type support when constructs become too complicated, or they become so complicated no one can understand them. Languages with the best type systems (OCaml) aren't particularly popular, while languages we think of as strongly typed (eg Java) have big backdoors to allow people to bypass the type system. On the other side, weakly typed languages are adding typing-like features by integrating unit test facilities into the environment (which - optionally - catch many of the bugs typing can help with). Like so many things, optional typing might seem impure, but often messy systems are the most robust.
- pcwalton 14y agoDart's optional typing is not common in languages at all. What you're referring to is a combination of dynamic and static typing, which is not Dart-style optional typing. In statically-typed languages, the dynamically-typed values are clearly delimited in the source text and are not a compiler switch.