Swift is like Kotlin
271–280 of 364 posts
Re: Swift is like Kotlin
#272Kotlin lacks the ability to do true functional programming that Swift has. Swift has pattern matching, recursive data structures (edit: specifically ADTs with enums or case classes is what I was thinking of here, should have written algebraic data types), tail call optimization, even some form of type classes, immutability (thanks @tmail21), and so on. Kotlin does not have any of these (edit: this is now partly false…
Kotlin has somewhat pattern matching: https://kotlinlang.org/docs/reference/control-flow.html#when...
Tail call optimization: https://kotlinlang.org/docs/reference/functions.html#tail-re...
Type classes: https://kotlinlang.org/docs/reference/sealed-classes.html
And I'm not sure what you mean by recursive data structures. Basically every C style language I'm aware of can contain a reference to another instance of its own type.
It's more java-y than Scala, but it's fundementally capable of a very FP style.
Re: Swift is like Kotlin
#273Kotlin lacks the ability to do true functional programming that Swift has. Swift has pattern matching, recursive data structures (edit: specifically ADTs with enums or case classes is what I was thinking of here, should have written algebraic data types), tail call optimization, even some form of type classes, immutability (thanks @tmail21), and so on. Kotlin does not have any of these (edit: this is now partly false…
Re: Swift is like Kotlin
#274Earlier quoted context omitted.
One might say you need... java. With regards to the potential politics of naming things I think it's a tricky thing. When a brand has been established it's already too late and what started as "Naming something after a Russian island" ends up being problematic. We're too global in software development to release a brand renamed in certain regions to solve this the traditional way, so libraries and languages have to b…
A simple heuristic: if a developer has a hissy fit over the project names of Coq, Brainfuck, or Stalin, don't work with them.
It's reasonable to distance yourself from a bad name, just as many people have chosen to rename things that were named Isis.
Re: Swift is like Kotlin
#275I find it very annoying that Google and Apple are creating new languages to solve similar problems and not worrying about cross platform. If you write for Apple you've been told to use Objective-C and Swift. If you're on Android it's Dart and now Kotlin. None of that stuff is used for Windows or Linux development or even mobile on the other OS. I'm not a fan of proliferation of "platforms" but when it goes beyond lib…
Re: Swift is like Kotlin
#276Kotlin lacks the ability to do true functional programming that Swift has. Swift has pattern matching, recursive data structures (edit: specifically ADTs with enums or case classes is what I was thinking of here, should have written algebraic data types), tail call optimization, even some form of type classes, immutability (thanks @tmail21), and so on. Kotlin does not have any of these (edit: this is now partly false…
recursive data structures: I don't get this one, kotlin has all the java api available and all the third party libraries. As java has been here for much longer than swift I guess that swift is lacking more here than kotlin.
Tail call optimization: kotlin has the special word tailrec for this
Yes, kotlin has a lot of things. It also has co-routines like in go, it also compiles to java script and much more.
The reason Google is supporting kotlin and not swift or scaala is because they have to do nothing to support it. Kotlin compiles to bytecode, so it doesnt matter your code is written in java or kotlin because when you compile it it is bytecode at the end. Scala needs to add a runtime when compiling to bytecode, it takes much longer to compile than kotlin and it is not fully compatible with java as kotlin. And Swift it is just something completely different, they should change the virtual machine in order to support it.
Re: Swift is like Kotlin
#277The article is missing the similarities between Swift Optionals and Kotlin Nullables. Swift 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…
Re: Swift is like Kotlin
#278Earlier quoted context omitted.
> Xcode isn't perfect, but it's way better than JetBrains. O_o Are you kidding me? People whinge all the time about jetbrains subscriptions, but I've literally never spoken to someone who's actually used their products and think that the alternative editors available (visual studio, xcode, etc) are actually better. There are some features like UI designers that you can't do without, but it's been a long time since I…
I tried AppCode to write in objc on mac and it felt way less transparent and smooth than Xcode. Idk if Xcode is missing some features, but all my real issues probably exist in different planes. My Xcode inconvenience points are: case-insensitive completion sometimes gets in my way, as it is with single lettered variables; it is easy to break constraints for non-trivial xib. I can live with both. What is it for you, i…
Re: Swift is like Kotlin
#279Does anyone else think the Kotlin syntax for array literals is super ugly: val shoppingList = arrayOf("catfish", "water", "tulips", "blue paint") What is wrong with square bracket syntax? (rant over). EDIT: I suppose it's consistent with other syntax e.g. listOf() etc.
It is more ugly for arrays but much more helpful for other things. And it also make sense with the lists as you said.
Re: Swift is like Kotlin
#280Here in Ukraine it would be very hard to get adoption of a programming language that is named after a Russian military base. This is the rare case where bad naming choice really hurts. No matter how good is the language, you will have to hear and pronounce that name many times a day, and even associate yourself with it (e.g. "a Kotlin developer" in your resume). Not something to be taken lightly.