I don't get it. Kotlin was a clone of swift. So the title is wrong.
Swift is like Kotlin
241–250 of 364 posts
Re: Swift is like Kotlin
#242Earlier quoted context omitted.
> # using \ is looking for troubles Are you referring to escaping and other special sequences (e.g. unicode codes)? Though it is odd-looking I actually find it rather smart that they decided to reuse an existing mechanism for that: aside from delimiters the only magical character in a string is \ rather than have e.g. both \ and $. > # the useless () My beef is more with 1..5 being inclusive and there apparently bein…
About \, yes it's the possible clash with a real quote. More an inconvenience to the reader that a source of bugs, but also that. About ranges, Ruby has both .. and ... and after 12 years I don't remember which is what. Maybe an inclusive one is enough and 1..(n-1) About syntax in general, it should be easy for developers no matter how hard it is for the compiler/interpreter to parse it. I don't like to have to type…
Re: Swift is like Kotlin
#243Earlier quoted context omitted.
I assume Google will try to replace Java with Dart, because they have recently been focused on Flutter [1] [2] and Fuschia [2] development which are (mostly) C++ and DartLang stack. [1]: https://flutter.io/ [2]: https://github.com/flutter/ [3]: https://github.com/fuchsia-mirror
> I assume Google will try to replace Java with Dart I would have expected this, but not after pushing Kotlin. Kotlin is shiny enough to temporarily distract the typical developer from the daily struggles with the abysmal Android API. Kotlin and Java it will be for the next 10 years, for better or worse. Dart is not very popular within Google itself, and Fuchsia is nothing more than a paid hobby project[0]. [0] See h…
[0]https://arstechnica.com/gadgets/2017/05/googles-fuchsia-smar...
Re: Swift is like Kotlin
#244Re: Swift is like Kotlin
#245There does seem to be broad agreement across a range of typed languages -- TypeScript, Swift, Kotlin, ES6 + Flow -- about notations for classes, control flow and data structure declaration. But true convergence remains far away...
Is this broad agreement due to theoretical alignment, or a deliberate attempt to increase programmer adoption? If true convergence happened, there wouldn't be a need for different languages. :-)
There are still areas of debate, but at the same time I think there is real progress; we have learnt from past mistakes and they won't be repeated.
Re: Swift is like Kotlin
#246Earlier quoted context omitted.
I assume Google will try to replace Java with Dart, because they have recently been focused on Flutter [1] [2] and Fuschia [2] development which are (mostly) C++ and DartLang stack. [1]: https://flutter.io/ [2]: https://github.com/flutter/ [3]: https://github.com/fuchsia-mirror
> I assume Google will try to replace Java with Dart I would have expected this, but not after pushing Kotlin. Kotlin is shiny enough to temporarily distract the typical developer from the daily struggles with the abysmal Android API. Kotlin and Java it will be for the next 10 years, for better or worse. Dart is not very popular within Google itself, and Fuchsia is nothing more than a paid hobby project[0]. [0] See h…
Re: Swift is like Kotlin
#247Earlier quoted context omitted.
Yes, but the corresponding design decision would be "0..=n". Swift's "0...n" is a bit less obvious. Also, exclusivity is almost always what you want, so "0..n" should just default to exclusivity and "0...n" could be inclusive.
As an alternative opinion, I personally hate when ranges are exclusive by default. In addition to it feeling somewhat unintuitive to me that I need to use range(0, 6) to include 5, it also makes downward ranges quite awkward, e.g. needing range(5, -1) to count from 5 to 0.
Another benefit: creating a series of right-exclusive ranges from a sequence [a, b, c, f] is easy: [a, b) [b, c) [c, f)
Re: Swift is like Kotlin
#248Re: Swift is like Kotlin
#249I think it is worst to have such similarities with very small different details than having completely different languages. For a developer working on both ecosystems it feels like hell to remember the tiny details.
Re: Swift is like Kotlin
#250Swift code:
var name: String?
name? ///returns a safe value
name! ///returns an unsafe value and throws an exception in case of a nil value
if name != nil {
///Now we can use name! forcing unwrap because we know it's not nil
}
if let unwrapedName = name {
/// Here we can use unwrapedName without forcing the unwrap
}
The null checks are almost the same in Kotlin: https://kotlinlang.org/docs/reference/null-safety.html