News for hackers. Stuff that matters.
Re:10 Years of Scala.js by MasterScrat on Sunday February 05, 2023 @10:32AM (#34665665)
I had no idea this was a thing! and I learned Scala from Prof Odersky himself ;-)

What are the selling points of Scala.js vs modern JavaScript/TypeScript?

Re:10 Years of Scala.js by sjrd on Sunday February 05, 2023 @10:54AM (#34665855)
Probably all the same selling points that Scala/JVM has over Java or Kotlin. The main one would be favoring a coding style with immutable data, only reaching for mutability when necessary. If you like that style, Scala.js will help you write in that style.

See also one of my other answers with some more comparisons.

Re:10 Years of Scala.js by nikitaga on Sunday February 05, 2023 @01:21PM (#34667281)
Typescript is not actually very type safe, and although they sometimes make small improvements on that front, the unsafety is fundamentally very much by design, they prioritize supporting all the dynamic Javascript idioms over type system soundness, it's even in their docs somewhere.

Scala is a very nice and expressive language with a much safer type system. It lets you program in a very reasonable mix of FP and OOP without going to the extremes of either approach. You're not beholden to weird Javascript idioms yet you can still easily use JS libraries (we have ScalablyTyped which is like Typescript's DefinitelyTyped).

Typescript is generally well loved partly because for many Javascript developers it is their first and only statically typed language, so they tend to attribute the benefits of static typing to Typescript, and attribute the problems specific to Typescript to static typing in general. This makes it hard to sell Scala.js to this audience, but I still encourage JS devs to try other statically typed languages, maybe you'll like them much more.

Re:10 Years of Scala.js by AlexITC on Sunday February 05, 2023 @05:42PM (#34670519)
> This makes it hard to sell Scala.js to this audience, but I still encourage JS devs to try other statically typed languages, maybe you'll like them much more.

Actually, I have had some success onboarding js devs into sjs, until now, all of them have mentioned that it is hard to go back to js/ts because the type-safety just can't be compared (I even presented this at a conference last December).

These are some comparisons on js vs sjs code on top of react (js on the left, sjs on the right):

- Hello World: https://pbs.twimg.com/media/FngeaoraAAAr2r0?format=jpg&name=...

- Timer: https://pbs.twimg.com/media/FnlL1PjaMAEL-zJ?format=jpg&name=...

- ReCAPTCHA usage: https://pbs.twimg.com/media/FnvY_hAagAIjWF5?format=jpg&name=...