Live data from Hacker News

From first principles: Why I bet on Scala.js

lihaoyi.com

31–40 of 90 posts

Re: From first principles: Why I bet on Scala.js

#31
post #8

I've backed the current iteration of my career on Scala and like the idea and some of the practicalities of Scalajs but it is destined to be limited to fun projects. The unavoidable problem is by committing to Scalajs you are accepting that you can no longer go out and get one of any number of JavaScript contractors or staffers to come on board and develop / maintain you client code and have to always have a Scala de…

Seconded. I love Scala but when I hire for Scala devs there are so few that I just hire the smartest developer I can find with FP experience and their first task is learning Scala.

If I was starting something now I'd be tempted to use TypeScript if I wanted one language on the front-end and the back-end.

Re: From first principles: Why I bet on Scala.js

#32
post #25
post #4

3 things I don't like about Scala: 1. It's based on the Java platform. 2. It's excessive use of operator overloading. 3. Mad implicit conversions all over the place. (yes, I exaggrated a bit ;))

> 2. It's excessive use of operator overloading. Overloading at least some could be useful. Java 10+ will probably allow something like this, too. You ever worked with BigDecimal? In Python, Scala where + (__add__) is overloadable you do. BigDecimal(1) + BigDecimal(2) + BigDecimal(3) On Java: (new BigDecimal(1).append(new BigDecimal(2)).append(new BigDecimal(3) I think you get the point..

Unfortunately, you also get

    Enumeratee.take(4) &>> Iteratee.fold[Byte, Int](0){ 
      case (acc, b) => acc * 256 + (b & 0xFF)
    }
It's a community thing, and much like Java suffered from excessive XML and patterns in the 200Xs, but is much better now, Scala has suffered from excessive operator noise, but it's getting better.

Re: From first principles: Why I bet on Scala.js

#33
post #18

For people who want to do typed functional programming on JS platform, there is another candidate: BuckleScript for OCaml: https://bloomberg.github.io/bucklescript/js-demo/ The compiler is compiled into JS and native code. It generates highly readable JS code and easier FFI. It compiles super fast (generally 10~100 faster than Scala) and generates optimized code.

and Fable for F# https://github.com/fsprojects/Fable

And you can use it with React Native![1]

[1] http://www.navision-blog.de/blog/2016/08/06/fable-react-nati...

Re: From first principles: Why I bet on Scala.js

#34
post #32
post #25

Earlier quoted context omitted.

> 2. It's excessive use of operator overloading. Overloading at least some could be useful. Java 10+ will probably allow something like this, too. You ever worked with BigDecimal? In Python, Scala where + (__add__) is overloadable you do. BigDecimal(1) + BigDecimal(2) + BigDecimal(3) On Java: (new BigDecimal(1).append(new BigDecimal(2)).append(new BigDecimal(3) I think you get the point..

Unfortunately, you also get Enumeratee.take(4) &>> Iteratee.fold[Byte, Int](0){ case (acc, b) => acc * 256 + (b & 0xFF) } It's a community thing, and much like Java suffered from excessive XML and patterns in the 200Xs, but is much better now, Scala has suffered from excessive operator noise, but it's getting better.

It would be fun, at some point, to compile a list of onomatopoetic translations for the various Scala operators that are found in nature. For example:

  >>=    "fffff...Pwip!" (the sound of monadic bind)

  |==>   "TCHvvvvvv..." (lightsaber igniting)

  |@|    "AAAAAAHHHH!"  (Edvard Munch 1893 operator)

Re: From first principles: Why I bet on Scala.js

#35
post #18

For people who want to do typed functional programming on JS platform, there is another candidate: BuckleScript for OCaml: https://bloomberg.github.io/bucklescript/js-demo/ The compiler is compiled into JS and native code. It generates highly readable JS code and easier FFI. It compiles super fast (generally 10~100 faster than Scala) and generates optimized code.

there's also elm and purescript, both of which are haskell likes

As well as GHC JS (not that I'd recommend it over Purescript)

Re: From first principles: Why I bet on Scala.js

#36
Scala is a cool language, but I can't help feeling that Javascript has a very strong culture around it that pretty much dooms adoption of things that don't feel "Javascript-y". I think the strong commitment to being a Javascript superset is the reason Typescript is blowing up the way it is.

Re: From first principles: Why I bet on Scala.js

#37
post #35

Earlier quoted context omitted.

there's also elm and purescript, both of which are haskell likes

As well as GHC JS (not that I'd recommend it over Purescript)

The huge difference is that Scala.js is production-ready, the other ones mentioned aren't.

Re: From first principles: Why I bet on Scala.js

#38
post #4

3 things I don't like about Scala: 1. It's based on the Java platform. 2. It's excessive use of operator overloading. 3. Mad implicit conversions all over the place. (yes, I exaggrated a bit ;))

Roughly none of those points are true (anymore).

Re: From first principles: Why I bet on Scala.js

#39
post #32
post #25

Earlier quoted context omitted.

> 2. It's excessive use of operator overloading. Overloading at least some could be useful. Java 10+ will probably allow something like this, too. You ever worked with BigDecimal? In Python, Scala where + (__add__) is overloadable you do. BigDecimal(1) + BigDecimal(2) + BigDecimal(3) On Java: (new BigDecimal(1).append(new BigDecimal(2)).append(new BigDecimal(3) I think you get the point..

Unfortunately, you also get Enumeratee.take(4) &>> Iteratee.fold[Byte, Int](0){ case (acc, b) => acc * 256 + (b & 0xFF) } It's a community thing, and much like Java suffered from excessive XML and patterns in the 200Xs, but is much better now, Scala has suffered from excessive operator noise, but it's getting better.

Scala Dotty will maybe have some kind of @infix("+") def add so that if it should be used via a + b it needs the infix else it's only possible todo a.+(b)

p.s. I banned scalaz and shapeless on my company so there aren't too much operator noises.

Re: From first principles: Why I bet on Scala.js

#40
post #35

Earlier quoted context omitted.

As well as GHC JS (not that I'd recommend it over Purescript)

The huge difference is that Scala.js is production-ready, the other ones mentioned aren't.

Purescript is pretty production ready. It's in use in production in a number of places.
Post reply on HN