4 ms·
Kotlin doesn't have the [] syntax. You just go someObjThatMayBeNull?.aMethod()?.aProperty : orSomeOtherExpression. I think that wins in terms of readability. A
by jillesvangurp 7y ago
Kotlin doesn't have the [] syntax. You just go someObjThatMayBeNull?.aMethod()?.aProperty : orSomeOtherExpression.
I think that wins in terms of readability. Also, every Android developer is already used to that syntax.
I hope Google at some point opens up Flutter to other languages. IMHO it's being held back by Dart at this point and they are barking up the wrong tree by not addressing that directly. People are reluctant to switch to it because they have to switch language to something less nice. The solution is not flogging the dead horse that is Dart by slowly adding bits of features that they hope will bridge the gap.
Kotlin now has a native compiler and reengineering Flutter to play nice with the LLVM ecosystem would also enable other languages. Like Swift, Rust or C++. Also, WASM is becoming a thing in the LLVM world. A Flutter evolution that properly integrated into that eco system would be quite a useful thing to have.
- netdur 7y agoif Kotlin get to point where it can compile to both AOT and native, Flutter will adapt it.
- spankalee 7y ago[] is an indexed data operator for Lists, Maps and other collections. It isn't a general property access operator like in JavaScript. It makes it possible to have user-defined list implementations with the ergonomics of built-in arrays, and drastically increases readability over Java's get() and set() methods. Don't knock it.
- half-kh-hacker 7y agoKotlin has [] but it can't be used with the null-safe navigation operator (?.) If you want to index a datastructure that could be null, you use ?.get(...) instead of ?[...]
- cbolton 7y agoNot sure about Flutter being held back by Dart. From my experience the language works really well for Flutter. For example Dart has first class support for asynchronous streams, very useful for a reactive framework. Flows in Kotlin are still experimental I think? The Dart version of async/await works really well, just what you need in Flutter code and simpler than suspended functions in Kotlin. The cascade operator is since syntactic sugar and, again, simpler and lighter than Kotlin's "apply". Then there are Flutter's killer features, mainly hot reload and soon the Web support. Is Kotlin.js in the same league as Dart? Honest question! Dart's JavaScript support is very mature, with 2 backends: one for development and one for production. And what's the hot-reload story on Kotlin's side? I could not find an answer on Google, but I did find[1] these words from the "IntelliJ IDEA product manager @ JetBrains, co-author of Kotlin in Action": "Flutter relies heavily on features that are only provided by the Dart VM. It’s not possible to add Kotlin support to Flutter without losing a lot of the things making Flutter attractive." So from a marketing standpoint maybe Dart is a liability, but technically I think it's a strength. I hope marketing won't have the last word! [1] https://twitter.com/intelliyole/status/1105493258954780672 https://twitter.com/intelliyole/status/1105493258954780672
- hota_mazi 7y ago> I hope marketing won't have the last word It's interesting you think JVM support is just marketing. For millions of developers around the globe, JVM support is a feature, and one they really can't do without. Dart is a liability to them because unproven, and its future is equally uncertain given Google's track record.
- cbolton 7y ago> It's interesting you think JVM support is just marketing I never said or implied that. I think maybe Dart is a liability from a marketing point of view because I saw many negative comments on HN which had more more to do with Dart's popularity than its technical merits. I was not talking about the JVM.
- munificent 7y agoEvery proven technology was unproven once. I remember when people said Java was too risky, GC was too slow, and it would never take off.
- zaphirplane 7y agoWhich side are you arguing for ;) couldn’t resist
- filleduchaos 7y agoTo be honest I feel like most people who knock on Dart have never actually written it.