Live data from Hacker News

From First Principles: Why Scala?

lihaoyi.com

151–160 of 342 posts

Re: From First Principles: Why Scala?

#151
post #101

> In contrast, cross-compilers for dynamic languages like Clojure tend to have a long-list of caveats and incompatibilites I don't think the author fully comprehended the linked resource (namely https://clojurescript.org/about/differences ). Perhaps he just noted the its size. A good chunk of the document lists things in common, not differences. The actual differences have nothing to do with dynamic typing and are de…

> - don't pretend the JVM and JS have identical runtimes when it comes to concurrency or numerics. Clojure is a language, not a platform abstraction. > - Emit efficient, optimally minifiable javascript code, at the cost of offering something less traditionally lisp-y when it comes to eval, macros, and other forms of code loading. Those are still possible, but some discipline is imposed. This is exactly the kind of th…

How is concurrency implemented in Scala.js? Eg switching tasks when you use Future for concurrent long running tasks that do IO or sleep?

Re: From First Principles: Why Scala?

#152

If I've said it once I've said it a thousand times: the day Scala kills sbt officially will be the day thousands of devs consider a return to it. Until then, I couldn't dare.

curious. what exactly is wrong with sbt? I used it once of twice when I was learning scala and I liked it a LOT more than gradle/maven. To the point where I actually opted to use it with my Kotlin projects later.

You need a phd in sbt to do things like "copy the jars", or "have a second set of dependencies".

The proponents of the approach that sbt takes have failed to realise that build tools have zero value whatsoever, every second spent on them is a second wasted.

What you want is a good mix simplicity (yes copy paste is fine) and some basic examples to follow, and the ability to break out into script if you are doing something unusual.

Re: From First Principles: Why Scala?

#153
post #9

Scala is nice for doing things with Spark compared to say, Java, but I really think that Kotlin can do just as well. The only advantage Scala has with Spark is the syntactic sugar. Once there is an API for Kotlin (beyond the preview version), I will be dropping Scala like a bad habit. Kotlin is also concise, has better IntelliJ support, less "implicit magic", and better Java interop. https://github.com/JetBrains/kotl…

> has better IntelliJ support That's gonna be hard to beat for most languages I guess, the best IntelliJ support will most likely always go to Kotlin :-)

That's not actually true, IntelliJ support for Java has always been much better, and still is today! Just try auto-completion in Java VS Kotlin in your IDE... it's much faster in Java files, something I've been complaining about as I've been using more Kotlin than Java, recently. Check also how many refactorings are available in your Java files compared to the Kotlin ones.

Jetbrains knows its main source of income is still, by far, Java, so they don't drop that ball.

Re: From First Principles: Why Scala?

#154

Earlier quoted context omitted.

The two major SQL libraries in the Scala ecosystem these days are Doobie ( https://tpolecat.github.io/doobie/ ) and Slick ( https://scala-slick.org/ ). With Doobie you manually write your queries, and then map the results into the objects in your domain model. Nothing is generated for you. OTOH, nothing is hidden and you are free to write queries as optimized and specialized as you need. The real selling point of Doo…

Isn't JOOQ also usable with Scala?

Yes

Re: From First Principles: Why Scala?

#155
post #107

Earlier quoted context omitted.

This is my biggest gripe with Scala as well. I'm sure it's a great language, but I've often seen it used to add complexity where none is necessary. It's abused to give developers a sense of accomplishment and intellectual superiority. In fact, in one project my former employer was involved in, one main reason they picked Scala was to, on the one hand, weed out the chaff from their existing team of .net developers (in…

>...I've often seen it used to add complexity where none is necessary. This reminded me of a great blurb about Niklaus Wirth's approach to languages: >Wirth’s philosophy of programming languages is that a complex language is not required to solve a complex problem. On the contrary, he believes that l languages containing complex features whose purposes are to solve complex problems actually hinder the problem solving…

Niklaus Wirth designed and implemented the languages Pascal, Modula-2 and Oberon of which the last one is the smallest.

https://miasap.se/obnc/oberon-report.html

Re: From First Principles: Why Scala?

#156

I am a Scala programmer & think it's a great language. Here are some arguments for why not Scala: * Li's libs (os-lib, upickle, utest) have clean public interfaces, but most Scala ecosystem libs are hard to use, see the JSON alternatives for examples: https://www.lihaoyi.com/post/uJsonfastflexibleandintuitiveJS... * The Mill build tool looks a lot better than SBT, but seems like everyone is still using SBT * Scala mi…

> Hard to win technical arguments with Scala geniuses that like using complicated language features. I was on a team building good old crud apps using monads, monoids, categories, combinators, effects cats, seamless and bunch of other nonsense that i've now purged from my brain. You could've easily mistaken our team for a programming language research group at a university. This is literally the number one reason i w…

Just because you don't like it doesn't mean you should be a good fit for their team.

Re: From First Principles: Why Scala?

#157

Earlier quoted context omitted.

I still find that Scala devs think they’re writing Haskell. From what I’ve seen in the community, no one cares about shipping code, they care about whether or not it’s “pure”.

To give them their credit. The argument from the purists is that purity is itself about shipping code. As a long-time scala developer who has started using the pure-FP ecosystem (cats,cats-effect mainly) I am starting to see their point. It takes some time to grok but once you do then it is amazingly productive to work with.

Maybe you’re on an exceptional team, but I’ve never seen a Scala team that could deliver faster than a Python / Ruby / Java team.

Scala teams also have a hard time hiring and if they hire a dev that’s new to Scala they then have to deal with a very long ramp up time.

Re: From First Principles: Why Scala?

#158
I'm most interested in Scala's structural typing.

Are there any studies comparing real world impact of structural vs nominal typing?

Defects? Code size? Team size? Architectural choices, big and small, like use of Visitor design patterns?

I've looked, but no joy.

--

FWIW, metaprogramming should be reserved for personal projects and small high trust teams. Definitely not for bog standard data processing and CRUD apps.

I'm kinda curious how structural typing story plays out in this dichotomy.

Re: From First Principles: Why Scala?

#159

Earlier quoted context omitted.

I don’t know of anyone at those companies using clojure and I haven’t seen any tech blogposts by those companies about using clojure. If clojure exists at those companies I imagine it’s a small very niche team.

One very public example of a Clojure shop through and through is NuBank out of Brazil, who employs some 700 "Clojure developers" according to them. In fact they are so committed to Clojure they bought Cognitect last year.

Don't bother, I have the feeling randmeerkat will argue that if the team is so big, the language must be not expressive!

Re: From First Principles: Why Scala?

#160
post #107

Earlier quoted context omitted.

This is my biggest gripe with Scala as well. I'm sure it's a great language, but I've often seen it used to add complexity where none is necessary. It's abused to give developers a sense of accomplishment and intellectual superiority. In fact, in one project my former employer was involved in, one main reason they picked Scala was to, on the one hand, weed out the chaff from their existing team of .net developers (in…

>...I've often seen it used to add complexity where none is necessary. This reminded me of a great blurb about Niklaus Wirth's approach to languages: >Wirth’s philosophy of programming languages is that a complex language is not required to solve a complex problem. On the contrary, he believes that l languages containing complex features whose purposes are to solve complex problems actually hinder the problem solving…

What makes this quote really interesting is that Wirth was Martin Odersky's (guy who designed Scala) PhD advisor!
Post reply on HN