Live data from Hacker News

Swift is like Kotlin

nilhcem.com

351–360 of 364 posts

Re: Swift is like Kotlin

#351

There 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. :-)

Some of it is due to theoretical alignment. For example, succinct function expressions come out of the the desire to simplify use of functional programming. Another example is the adoption of ML-style type notation: we want people to use static types, we want it to be easy, and we want types to be expressive -- : allows to contain some spaces and punctuation while still being clear.

Re: Swift is like Kotlin

#352
post #71

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

Ebat ty swidomit

Re: Swift is like Kotlin

#353

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"?

And Guantanamo Bay is a bay besides also having a base there.

I know nothing of Kotlin's specific name associations, but I don't think "it's the name of a place, therefore its fine" is valid in general. I think "Sandy Hook" would be an inappropriate name right now, while "Wayland" is fine, despite both being towns in the same general region of the world: one name invokes something specific in peoples minds and the other does not.

Its sort of like how its generally not a good idea to be named "Isis" right now, despite having plenty of harmless associations unrelated to ISIS. You might be named after the Egyption god but you are still invoking an association that you don't really want to:

https://en.wikipedia.org/wiki/Name_changes_due_to_the_Islami...

Re: Swift is like Kotlin

#354
post #290

Earlier quoted context omitted.

Imagine having hundreds of languages with only trivial difference in syntax. Consider the fragmentation and effort wasted on re-inventing the same low level libraries again and again (here is the hundredth version of unit test library). Sure, only language would be bad but so is too many.

If a language has trivial difference from another language, I doubt it can gain traction. Can you cite an example?

A language doesn't gain traction cause of syntax or anything like that. It gains traction because a platform developer promotes it.

C# and Java had what amounted to trivial differences, when they started.

Kotlin and Swift also aren't very far apart, both in terms of syntax and power (in Blub power continuum terms).

There's very Computer Science-y reasons for these languages to exist as separate languages, but they do cause of product differentiation and platform lock-in efforts.

Re: Swift is like Kotlin

#355
post #342
post #190

Past the syntax similarities, both of these languages are intended replacements for an 'old' language (Objective-C => Swift, Java => Kotlin) on a dominant mobile platform, with interoperability as a major selling point (requirement?). As a mobile dev (mainly iOS) this is awesome to see and although I love me some Objective-C, working with swift has been a pleasure. Now Java on the other hand... ( shudders ). With Goo…

> both of these languages are intended replacements for an 'old' language (Objective-C => Swift, Java => Kotlin) It may be true for Swift but Google never claimed Kotlin is replacement of Java. I guess people are getting overly excited and making claims that Google did not. Kotlin is low effort developer friendly move by Google. Jetbrains will do work on language and tooling and Google would provide some Android-Kotl…

That's true Google never named Kotlin as a replacement to Java. Although naming it a first-class Android language seems like a pretty big move (actions over words), and given an official option between Java and Kotlin I believe most dev's will begin moving towards Kotlin. intended was probably the wrong word for me to use, should have been probable or likely.

Re: Swift is like Kotlin

#356

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.

It's not pretty, but it makes sense so that you actually think about whether you need an array vs list vs ? instead of just going for whatever datastructure [] is going to give you because it's most convenient.

In practice, it's something I stopped caring about within the first hour.

Then again, mikeash's comment pitches a more interesting idea: [] as generic collection literal syntax that depends on inference / annotation to pick a concrete implementation. Best of both worlds. I'd just remove the Array default.

Re: Swift is like Kotlin

#357

Earlier quoted context omitted.

Which is actually not the case for most Ukrainians of Russian descent: Most of ethnic Russians in Ukraine signed for the Ukrainian army, fighting against Putin’s invasion, against the same Russians that came from the other side. (from http://marginalrevolution.com/marginalrevolution/2017/05/con... . Note the source is Kasparov, who is not an entirely unbiased source where Russia is concerned ;))

Well, it's a big question - what is real "ethnic" russian. It's like an "ethnic USA citizen".

Less so though, as USA was from the onset a nation of hodgepodge nationalities from everywhere -- and without a much older local culture (except of the Indians, which were genocided away).

It was the constitution/law that held US together as a nation instead of a shared history/culture (well, except WASP culture, which is on the wane).

Re: Swift is like Kotlin

#358
post #123

Earlier quoted context omitted.

Opinionated, I suspect, but not hyperbole.

There is such a thing as a hyperbolic opinion or reaction. Not trying a language because one dislikes the syntax for one of 2000 features it has, and not even the most important one, looks hyperbolic to me.

It doesn't look hyperbolic to me. If I dislike the syntax of a language, I can probably find a better one with the syntax I prefer. Maybe this is a negative side-effect of having too many options, but I don't think it's unreasonable to pass up on something for purely stylistic choices.

Re: Swift is like Kotlin

#360

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…

Tail recursion is a special case of tail calls that can be turned into loops. Their keyword is called tailrec, so it's probably not real TCO. Real tail call optimization can't easily be turned into loops in the general case.
Post reply on HN