Live data from Hacker News

Swift is like Kotlin

nilhcem.com

291–300 of 364 posts

Re: Swift is like Kotlin

#291
post #241

I don't get it. Kotlin was a clone of swift. So the title is wrong.

Kotlin was first released at least a couple of years before anyone outside of Apple had even heard of Swift.

Ah ok. Wikipedia says 2011.. Didn't hear about kotlin until a few months after swift was released

Re: Swift is like Kotlin

#292
post #101

Earlier quoted context omitted.

I looked it up, and Kotlin is an island ( https://en.wikipedia.org/wiki/Kotlin_Island ) 1,000km north of Ukraine. Is it a case like Alcatraz, where the location has become idiomatically synonymous with the facilities?

Kotlin is a place where https://en.wikipedia.org/wiki/Kronstadt was founded. You can say that Kronstadt become idiomatically synonymous with the facilities. Not too sure about the Alcatraz, but Kronstadt is the pride of Russia (and I doubt many people would be happy to see it being compared to a prison-island, lol)

I have no issues with Kronstadt. Kronstadt also is the germanic name of Brasov in Romania. Lovely city. There are probably many other Kronstadt's. It just means "Crown City".

It's worth remembering that different names have different connotations to different people. And that different things may have the same name. If you are trying to market something you obviously have to keep in mind the connotation to the name to the target demographic. And if someone outside your target demographic complains about the name you probably don't care. On the other hand, in the land of open source those connotations are meaningless. Creators of open source tools don't really rely on marketing.

Re: Swift is like Kotlin

#293

Earlier quoted context omitted.

I think it depends on more nuance than that: I do think it would be reasonable for people to avoid a language called Guantanamo because of the name associations. Wayland happens to be a place in MA but I'm from near there and even I had no idea or prior associations with that name because of the place.

Kotlin is not the military base, it is an island. Would you object to a language named "Cuba"?

Well there is this: https://www.cuba-platform.com/ So if you want to object you can do so already.

Re: Swift is like Kotlin

#294

Kotlin 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…

pattern matching: swift has switf and kotlin has when, both are very similar 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-ro…

> Scala needs to add a runtime when compiling to bytecode

This is nonsense? It doesn't need any more "runtime" than Kotlin does.

> it is not fully compatible with java as kotlin.

This is a lie. (I don't say this lightly, but I've seen it too often from too many kotlin advocates for it to be an innocent mistake)

Re: Swift is like Kotlin

#295
post #67

Earlier quoted context omitted.

Yes, agreed. IMO, curly braces would have made much more sense. It's not even bikesheding, really. It's just a fact that curly braces are less used in most written languages. I would also argue that curly braces are a better signal to the programmer that "something programmatic is happening here", due to their prevalence as scope delimiters in most popular languages. Swift's string interpolation doesn't catch my eye…

I definitely think a general guideline for language designers could be "when in doubt, make it look like Ruby". The language has its issues, sure, but damn if it didn't get syntax just right .

> but damn if it didn't get syntax just right.

Yeah, like the symmetry of `do` / `end`! /s

Re: Swift is like Kotlin

#296

Kotlin 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…

Maybe you haven't checked out Kotlin lately? 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 co…

I agree with Filligree that sealed classes are not really capable of emulating type classes. They can be used for algebraic data types, which is great, but for true extensible type classes you'd need something like Scala traits.

Re: Swift is like Kotlin

#297

Does 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.

I've had the same issue with Scala. It goes out of its way to provide every syntax convenience that has ever existed--pattern matching, custom string interpolation, literal syntax for tuples, optional parens on method calls--- and then requires Maps and Seqs to be created with syntax like

val shoppingList = Seq("catfish", "water", "tulips", "blue paint")

Re: Swift is like Kotlin

#298

Earlier quoted context omitted.

One has a top-notch IDE from a top-notch IDE vendor. The other has XCode. Also, ARC aside, for the 3-4 items you mentioned, either Kotlin also also has them, or has just as good alternatives. And none of those are life-changing. ARC vs a good GC is just a different tradeoff (no cycle detection vs pauses, etc). I'm sure you can find some things where Swift is better at, and others where Kotlin is. But not that many to…

Sure thing... When will Jetbrain have a decent interface builder? Decent instrumentation? Decent documentation viewer? Can you get an object graph with JetBrains? Xcode isn't perfect, but it's way better than JetBrains. Just because one has one feature that one doesn't have, doesn't mean that Xcode beats JetBrain's IDE all day.

Nobody should be using IB at all for iOS development. Ever.

Re: Swift is like Kotlin

#299

Does 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.

I've had the same issue with Scala. It goes out of its way to provide every syntax convenience that has ever existed--pattern matching, custom string interpolation, literal syntax for tuples, optional parens on method calls--- and then requires Maps and Seqs to be created with syntax like val shoppingList = Seq("catfish", "water", "tulips", "blue paint")

I personally like that about scala. If I decide an IndexedSeq is better than my original choice of List, it is just a rename, not a syntax change.

Re: Swift is like Kotlin

#300

I 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…

> If you're on Android it's Dart and now Kotlin.

I think you meant Java and now Kotlin? Google never recommended Dart for Android development. They have Flutter which uses Dart, but that positions itself as a cross-platform way to build apps and doesn't have any support from Android tooling or things like that. It also still positions itself as an alpha, so do with what what you will.

But Kotlin also works just fine on JVM. So Kotlin works on MacOS, Windows, Linux, and now Android. That sounds pretty cross platform to me. Kotlin is also not a language from Google, so I don't know why you're annoyed with Google on this one. Kotlin is from JetBrains.

Post reply on HN