News for hackers. Stuff that matters.
Re:Swift is like Kotlin by pillowkusis on Thursday May 18, 2017 @10:45AM (#14367620)
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 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 by Filligree on Thursday May 18, 2017 @11:00AM (#14367776)
> Type classes: https://kotlinlang.org/docs/reference/sealed-classes.html

Those are not type-classes, at least not in the Haskell sense. They allow you to avoid an else branch, yes, which is actually quite useful; but one basic ability they're missing is the ability to define a new branch for a new instance of the type defined by library users.

Just as an example. They're really not much like type-classes at all.

Re:Swift is like Kotlin by jnbiche on Thursday May 18, 2017 @11:41AM (#14368157)
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 by masklinn on Thursday May 18, 2017 @01:23PM (#14369139)
> Type classes: https://kotlinlang.org/docs/reference/sealed-classes.html

Sealed classes are an odd/wonky take on sum types, they're not even remotely close to type classes.

Re:Swift is like Kotlin by zejay on Saturday May 20, 2017 @09:45AM (#14382335)
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.