Live data from Hacker News

From First Principles: Why Scala?

lihaoyi.com

291–300 of 342 posts

Re: From First Principles: Why Scala?

#291
post #145

Earlier quoted context omitted.

In the Spark world, you can use a tiny subset of the Scala features and enjoy huge productivity gains over the other language APIs (Java & Python). Those productivity gains are wiped out as more crazy language features get used. I don't think the super complex language features should be removed. Li's libs do some crazy stuff under the hood, but provide a clean, Python-like public interface. Most devs aren't that goo…

> Lots of folks would love Scala codebases that only use 10% of the available language features and none of the complex frameworks. They already do it: it's called Kotlin.

On the other hand Kotlin devs can also be really conservative in what they let creep into the language. But that's what I like about the language, it doesn't try to please everybody and that create a somewhat more rigid frame in which I'm more comfortable expressing myself.

Re: From First Principles: Why Scala?

#292

Earlier quoted context omitted.

Nobody should be recommending Slick to anyone for new projects. Slick will not be supported in the future.

I've heard that too but I think there are at least efforts to support Scala 3. Having said that I think Quill looks nicer ( https://getquill.io/ ) if you want a DSL like that.

I haven't used it heavily but one of our newer microservices uses Quill for read-only access to Postgres. I have found it to be great to work with, to combination of "just use case classes" and a DSL that feels like writing SQL is pretty nice.

Re: From First Principles: Why Scala?

#293

I have used python and scala for work and I find myself wishing to be able to use scala a lot when I use python (especially when using pandas or trying to multi process/thread). Not so much the other way around even though I also love python and think it’s amazing. Main reason: The type system is great and there are so many things that I can express/enforce using it that are missing for me in python even using typing…

[deleted]

Re: From First Principles: Why Scala?

#294

I definitely agree that many newer languages are strongly inspired by Scala, but I don't see a strong argument for why to choose Scala over one of a newer hybrid language. My own intuition is that these newer languages have had the benefit of being able to learn from Scala's mistakes. A lot of them have intentionally sacrificed some of the Scala's flexibility to be easier to learn and use. I found Scala to be an extr…

What newer hybrid languages besides Kotlin can cover the benefits you can get with Scala: a solid ecosystem (both for Scala and Java) for developing web applications, microservices, data processing, and good performance. Julia, Rust, and Elixir are all great, but popularity, ecosystem are not there yet.

I've switched to Clojure, it covers all those basis.

Re: From First Principles: Why Scala?

#295
post #197

Earlier quoted context omitted.

> Scala collections are really great. It doesn't really matter how great they are, it kills JVM interop right there ... and its even worse if it doesn't and you get implicit conversions killing your performance. This is where there is a bit of bait and switch with the JVM story (applies to a lot of JVM languages) - "language has great feature X" and "use any library from the JVM ecosystem" - often turn out to be mutu…

> Groovy is the only JVM language I've found that seems to deliver a real JVM interop story Have you tried Kotlin yet? If so, what interferes with its JVM interop story in your opinion? I'm happily using Kotlin with several Java libraries, and IIRC, no Kotlin-specific libraries except for the stdlib.

There are some quirks when you need to call Kotlin code from Java, so it is not as transparent as the other way around. But still, the JVM interop from Kotlin is mostly transparent (if you remember that platform types can be null).

Re: From First Principles: Why Scala?

#296

I have used python and scala for work and I find myself wishing to be able to use scala a lot when I use python (especially when using pandas or trying to multi process/thread). Not so much the other way around even though I also love python and think it’s amazing. Main reason: The type system is great and there are so many things that I can express/enforce using it that are missing for me in python even using typing…

Yeah the extreme FP stuff works for some people, but not others, and that subcommunity has traditionally been very loud. I've been pushing hard on using Scala in a more hybrid way over the years, first with my open source libraries and then with my book Hands-on Scala. I think I've had some success in pushing this.

There's definitely been a shift in the community in this direction. While the hardcore-FP folks are still around, as are the hardcore-Reactive folks, there are now many others using Scala in this more simple, simplistic way to good effect. Scala is a big tent and every subcommunity can find things they like even if they don't always agree

Re: From First Principles: Why Scala?

#298
post #290

Earlier quoted context omitted.

Reading this thread is giving me some catharsis. I worked on a large project in a big tech company where the org’s leadership was ideologically determined to build everything in Scala. We ended up with dozens of engineers and failed to deliver basic functionality. The leadership eventually left the company and now they are running a startup with a few of the Scala savants from the old team. They got lots of funding a…

I don't think it is a Scala problem but more of a leadership/organizational problem. If you look at Jane street, they do everything in OCaml which is an interesting choice to say the least, but their stuff works, evolve and they can demonstrate...

Yeah, I don’t think Scala itself caused the problem. There was this mindset: “if we just properly model the universe in the type system, the solution will just fall out!”

Because that was the obsession, they ended up spending all their time iterating on this perfect type system and not enough on the product. I think people with that issue are more likely to want to use Scala.

Re: From First Principles: Why Scala?

#299

I loved Scala until a minor version updated somewhere around 2.9-2.11 destroyed all my hope. Eight years later I still refused to use it to build anything. Yet, with that said, IMHO, it can be fucking great _second_ language. If you haven't used a statically typed language before, i.e. you're from Ruby, JS, Python, et. al then it's one bangin' ass brain rodeo. I'd highly recommend spending a couple months trying to l…

> only to find this bad boi: https://www.scala-lang.org/api/current/scala/Function22.html Dang. I just checked in the Common Lisp I use and it's a bit higher. What's the reason for having to have at least 22 concrete function signatures like that? CL-USER> call-arguments-limit 4611686018427387903 (62 bits, #x3FFFFFFFFFFFFFFF)

It's for optimization, at run-time you could handle functions with more arguments, but with this it can be compiled to directly call the exact function based on the number of arguments statically used at the call-site and their type.

To do this though, you need a defined static type for the type of Functions each of a different number of arguments.

22 is just where they stopped to keep defining those types.

Re: From First Principles: Why Scala?

#300

I have used python and scala for work and I find myself wishing to be able to use scala a lot when I use python (especially when using pandas or trying to multi process/thread). Not so much the other way around even though I also love python and think it’s amazing. Main reason: The type system is great and there are so many things that I can express/enforce using it that are missing for me in python even using typing…

Yeah the extreme FP stuff works for some people, but not others, and that subcommunity has traditionally been very loud. I've been pushing hard on using Scala in a more hybrid way over the years, first with my open source libraries and then with my book Hands-on Scala. I think I've had some success in pushing this. There's definitely been a shift in the community in this direction. While the hardcore-FP folks are sti…

In my view though, Kotlin is just a much better version of that. But of course if you have lots of scala investment already, it makes more sense to do it within scala itself.
Post reply on HN