Live data from Hacker News

From First Principles: Why Scala?

lihaoyi.com

341–342 of 342 posts

Re: From First Principles: Why Scala?

#341
post #282

Earlier quoted context omitted.

Kotlin has lots of syntax sugar but the semantics are crazy. It's essentially an imperative language where the only way to reason about effects (suspend functions) is by reasoning about control flow. That already makes things like error handling incomprehensible, and it'll be a really bad fit for Spark's way of doing things (where values have to be serializable and shipped around the cluster) - imagine trying to use…

I'm curious what your use case is for using a suspend function in spark. I have written several spark jobs with Kotlin and have never had a reason to create one. The only difference from the Scala/Java jobs is that I had to be much more explicit with certain things (encoders in higher order funcs, etc.).

All of the reasons you'd want to use a suspend function at all - e.g. mutually recursive functions, async I/O (e.g. database queries), error handling - suspend functions seem to be kotlin's answer to anything even slightly non-vanilla. Writing in Scala I can, with care, use async and iteratees in spark and be able to reason about what's going to get executed where and when, because these things are represented as values.

Re: From First Principles: Why Scala?

#342

I want to switch away from Python, at least for personal projects. I want to broaden my range, experiment with weird paradigms (Raku) or get code that’s a little faster (eg Rust). The problem is that I use Python as a “glue language” and heavily rely on excellent third party libraries. I don’t want to learn how to write a minimum spanning theorem algorithm; I’m used to have it next to several other convenient graph u…

Raku also has the Inline::Python module, that allows you to use just about any Python (3) module "natively" in your Raku program. The interface is not as polished yet as it is with the Inline::Perl5 module, but there is a GSoC proposal to improve on that! https://github.com/perl-foundation-outreach/gsoc-2021-ideas/...
Post reply on HN