Re:Scala.js for large and complex front end apps [video]
by nawitus on Friday March 18, 2016 @03:46PM
(#11314378)
If static typing is the selling point of Scala.js you might as well use TypeScript, which would be familiar to JavaScript developers.
Re:Scala.js for large and complex front end apps [video]
by lomnakkus on Friday March 18, 2016 @03:55PM
(#11314451)
No. Static typing in TS is very very far from what Scala can do[1]. Just as an example: Scala can do type inference (albeit local) which TS cannot do in any meaningful sense. There's a huge difference and you owe it to yourself to try it out for a real project!
[1] My company started out with TS, but after converting about 10% of our app from TS to Scala.JS + scala.js-react we just decided to convert the rest in a mad sprint over a few weeks. It has paid off in spades. We still struggle with the abomination that is CSS and separating styles from components, but it is what it is.
Re:Scala.js for large and complex front end apps [video]
by nawitus on Sunday March 20, 2016 @01:53PM
(#11323846)
You're incorrect. TypeScript can do a lot of type inference. I've used TypeScript full-time for about two years, I don't have experience with Scala.js though.
Re:Scala.js for large and complex front end apps [video]
by airless_bar on Tuesday March 22, 2016 @02:13AM
(#11334735)
I think most types for which you would care about type inference in Scala can't even be expressed in Typescript ...
Re:Scala.js for large and complex front end apps [video]
by lomnakkus on Tuesday March 22, 2016 @05:13PM
(#11340002)
Yeah. HKTs are one particular instance, though even Scala doesn't necessarily do particularly well on those compared to e.g. Haskell (well, GHC, really).
(It seems subtyping and higher-order reasoning just don't mix well. Undecidability abounds, unfortunately. I tend to prefer higher-order reasoning over subtyping.)
[1] Yes, classes. As in: You can never misspell an object property and have that mistake make it into production (&c for lots of other types of bugs). Plus, you get automatic refactoring you can actually rely on. Now, your JS devs may not appreciate that, but I suspect that's just because they're inexperienced and/or haven't actually worked in a good[2] statically typed language. There's also the fact that we (as humans) unconsciously try to minimize our own mistakes; "oh well, it was just a typo and we fixed it quickly!" and for most of us mistakes tend to fade quickly from memory... thus leading to a very biased view of one's own development practices which doesn't take into account how many mistakes you really make.
[2] I'm going to do a D. F. Wallace here[3].
[3] ... and say that Scala isn't great as languages go[5], but I'll bet you it's a hell of a lot better than any statically typed language your typical JS devs have any experience with[4]. One particular gripe of mine is that they still permit "null", but that's because of Java compatibility. (Oh, how much better Scala could have been without Java compatibility.)
[4] ... which would obviously colour their perception of the trade-offs between static type checking and "verbosity", "bondage & discipline", etc.
[5] It is good, though.
I think that's enough footnotes for now.
EDIT: Sorry, I lied. Added another footnote. Really doing the DFW thing, but in Reel Time(TM).