News for hackers. Stuff that matters.
Re:Towards Scala 3 by stephen on Friday April 20, 2018 @10:43AM (#16885151)
...ships in 2020?

I'm impressed with what they're doing (and love the language), and it's hard work, and their speed is faster than, say, Java's dead-pace evolution in the 2000s.

But, poking around at TypeScript, I've been blown away with the MS/TS speed of development. ~2-3 month release cycles, with non-trivial changes to the language (mapped types, conditional types, etc.), that are themselves unique/novel type system features, not like Java finally getting around to copying the obvious/best-practice approach to case/data classes.

Granted, I'm sure the MS/TypeScript budget is huge comparatively...

Seems like that's the "best" (realistic) way for dev tooling to evolve lately: come from, or attach yourself to, a ~top-5 tech company that makes their money somewhere else and can bankroll developer tools/languages (e.g. MS with TS, FB with React/Flow, Google with a myriad of things e.g. Dart & AdWords, Go).

Bringing it back to Scala, seems like they were close to this (flirted with adoption/sponsorship from a few startups like FourSquare, etc.) but, thinking about it now, "software development in the large" is a huge concern for those companies (e.g. anyone with enough extra money to actually pay for language/tooling improvements), and that's never really been Scala's strong suit (compile times, painless compiler upgrades).

Re:Towards Scala 3 by munificent on Friday April 20, 2018 @12:56PM (#16886438)
TypeScript has a comparatively easier job because the type system is unsound. They can add new type features without needing to be paranoid about a hole in the system or a usability pitfall because the tools don't rely on types for correctness or optimization, and because users can easily cast to "any" or otherwise work around an annoyance.

When you want the whole system to actually deeply rely on the static type system, it needs to be much more robust, and that takes a lot of effort.

I'm not trying to minimize what the TypeScript folks are doing — it's a really nice, well-designed language. But the complexity required to evolve an optionally-typed language is closer to that of a dynamically-typed one than a statically-typed one.

Re:Towards Scala 3 by stephen on Friday April 20, 2018 @01:47PM (#16886877)
Good point; I've mused before that dynamic languages will always be a ~generation ahead of static languages, due to what you point out, that type systems are hard, and very few people start working on a new type system as their hobby project (vs. hacking out a new syntax with an interpreter).

But I hadn't appreciated the difference in difficulty between an unsound type system like TS and Scala's type system...

I guess I've taken the formalism that underlies Scala's type system (e.g. the academic research behind dotty) as a given/for granted, but you're likely right, that TS can move faster because it doesn't need/have that level of rigor.

Thanks!

Re:Towards Scala 3 by hota_mazi on Friday April 20, 2018 @09:36PM (#16889561)
> I've mused before that dynamic languages will always be a ~generation ahead of static language

Did you mean "behind"?

The trend is pretty clear: dynamically typed languages are disappearing and all the popular modern languages are statically typed with type inference.

Most dynamically typed languages are busy adding static safety through gradual or opt-in typing, but you don't see the other way around.

Javascript will probably be the last major dynamically typed language we ever had to use.

Re:Towards Scala 3 by bonesss on Saturday April 21, 2018 @09:22AM (#16891325)
> dynamically typed languages are disappearing and all the popular modern languages are statically typed with type inference

It does seems that all the dynamic languages are learning what the systems people knew in the 70s: for the Enterprise, correctness counts.

A happy v1 is only 10% of the story... Getting to v225.5, warts and all, is just something else.

Re:Towards Scala 3 by naasking on Friday April 20, 2018 @01:32PM (#16886737)
Is it actually unsound if you perform no casting? That seems to be a more interesting property, because then the additions they're making still have to mesh cohesively.
Re:Towards Scala 3 by munificent on Friday April 20, 2018 @01:49PM (#16886894)
> Is it actually unsound if you perform no casting?

Yeah, it is. At the very least, I know that function parameters are bivariant, which isn't sound:

    function foo(callback: (obj: Object) => void) {
      callback("not a bool");
    }

    function main() {
      foo(function (bool: Boolean) {
        if (bool) window.console.log("!");
      });
    }
This compiles without a type error but ends up assigning a string to a parameter of type bool.
Re:Towards Scala 3 by ItsMe000001 on Friday April 20, 2018 @02:01PM (#16887011)
I'm a Flow user rather than TS (and Flow complains about that code out of the box), but you are not telling us all:

Since TS 2.6, if you enable all the optional "strict" mode checks than TypeScript does complain about that code.

I see no disadvantage in those checks, e.g. "strictFunctionTypes", being optional, since you can always make them mandatory for your own project(s).

To test it:

- Go to the TS Playground at https://www.typescriptlang.org/play/

- Enter the above code

- Select "Options" and enable at least "strictFunctionTypes"

Re:Towards Scala 3 by naasking on Friday April 20, 2018 @02:07PM (#16887063)
Is that option documented somewhere? I imagine there are some tradeoffs with enabling it.
Re:Towards Scala 3 by ItsMe000001 on Friday April 20, 2018 @02:14PM (#16887139)
https://www.typescriptlang.org/docs/handbook/release-notes/t...

> TypeScript 2.6 introduces a new strict checking flag, --strictFunctionTypes.

> The --strictFunctionTypes switch is part of the --strict family of switches, meaning that it defaults to on in --strict mode.

> Under --strictFunctionTypes function type parameter positions are checked contravariantly instead of bivariantly.

> ...(etc.)

Re:Towards Scala 3 by naasking on Friday April 20, 2018 @02:28PM (#16887288)
Contravariance then, right. Thanks! I haven't gotten into Typescript yet, and at this point it looks fairly large and a little daunting, so this is helpful.
Re:Towards Scala 3 by tomerbd on Saturday April 21, 2018 @02:01AM (#16890186)
And this project is super interesting: https://1c.wizawu.com/#/whatis Use TypeScript on JVM with both NPM and Maven dependencies
Re:Towards Scala 3 by coryfklein on Friday April 20, 2018 @05:08PM (#16888446)
The major tradeoff, IMO, is that it is even toggle-able at all, let alone being a feature switch that is enabled by default.

If you enter any random TS project today, odds are it isn't using that switch, and enabling the switch will lead you down a month long rabbit-hole of fixing cascading type errors.

Re:Towards Scala 3 by bjterry on Friday April 20, 2018 @10:23PM (#16889672)
Not only that, but since it isn't required many libraries in the ecosystem won't be using it. Comparing my experiences with TypeScript and Flow vs. my experiences with Haskell, any optional type system is going to leave a lot of gaps if you don't have a pretty strict not-invented-here culture.
Re:Towards Scala 3 by ihsw2 on Friday April 20, 2018 @02:23PM (#16887224)
Tradeoffs? It might frustrate some people more accustomed to JS' loose type system.
Re:Towards Scala 3 by raquo on Friday April 20, 2018 @01:46PM (#16886863)
Yes, look at how it deals with type param variance for example. It doesn't.
Re:Towards Scala 3 by cinnamonheart on Friday April 20, 2018 @11:34AM (#16885619)
For what it's worth, this isn't just an evolution of the language, but a complete rewrite of the compiler. I appreciate that they're taking the time to do it right. They probably could've pushed new, non-trivial features out faster if they weren't doing a total rewrite.
Re:Towards Scala 3 by hota_mazi on Friday April 20, 2018 @02:02PM (#16887020)
Pity that in this rewrite, they were unable to speed up compilation speed. From the latest reports, dotty appears to compile at about the same speed (if not more slowly than) scalac.
Re:Towards Scala 3 by spockz on Saturday April 21, 2018 @01:00AM (#16890059)
Where did you get that from? I’ve seen performance increases of 2-3x mentioned on conference talks: eg here https://d-d.me/talks/scalaworld2015/ slide 50.
Re:Towards Scala 3 by acjohnson55 on Friday April 20, 2018 @10:51PM (#16889754)
This is pure speculation on my part, but my guess would be that better, simpler foundations and a fresh start end up unlocking a lot of optimization opportunities in the long run. But it would seem foolish to invest too much in optimization while things are still in flux.
Re:Towards Scala 3 by Blaisorblade0 on Friday April 20, 2018 @01:53PM (#16886928)
Scalac has evolved considerably, but it appears to be much harder to evolve. The Scalac team and contributors are backporting some of the Dotty features, but this is far from a trivial effort. Doing the same changes in Dotty is typically much easier in comparison.
Re:Towards Scala 3 by BurningFrog on Friday April 20, 2018 @12:10PM (#16885961)
This does nothing to change my opinion that total rewrites are almost always a horrible idea.
Re:Towards Scala 3 by pas on Friday April 20, 2018 @12:41PM (#16886295)
The Scala compiler has to be cleaned up. Maybe rewritten, maybe not. Dotty started as a fork of Scala, and now Odersky decided/announced that it'll be merged back eventually. (And it should conform to whatever the Scala language is/will be after the SIP processes for 3.0.)
Re:Towards Scala 3 by ionforce on Friday April 20, 2018 @05:22PM (#16888531)
I've never seen a system or project that's had a "big" change that wasn't always a total rewrite.

I guess it's always envisioned differently like "can we tackle this subsystem in isolation".

Re:Towards Scala 3 by JoeAltmaier on Friday April 20, 2018 @12:11PM (#16885971)
The old saying: "Its bigger and slower, but at least its more expensive!"

My experience says, a rewrite just has different bugs. Combined with delay and cost, its often not worthwhile.

Re:Towards Scala 3 by bad_user on Friday April 20, 2018 @12:54PM (#16886425)
> I've been blown away with the MS/TS speed of development

TypeScript broke my code for the past year on every new release.

---

Scala evolves a lot on each new version. There's a big difference between 2.10 and 2.12, the current version.

Dotty is a big change. That it ships in 2020 that's OK. Shipping it any sooner is risky.

Re:Towards Scala 3 by manojlds on Friday April 20, 2018 @10:58AM (#16885288)
It's not the next release. There is 2.13 and 2.14 to be released. Are you saying Typescript has major version release every 3 months?
Re:Towards Scala 3 by actsasbuffoon on Friday April 20, 2018 @11:29AM (#16885565)
Typescript does indeed do frequent releases, though they're not nearly as ambitious as Scala 3.0.

A Typescript release usually has 1-3 exciting new features, and a number of smaller bug fixes and improvements.

Re:Towards Scala 3 by benjaminjackman on Friday April 20, 2018 @01:39PM (#16886796)
Correct, but collectively, between now and 2020 it's almost certain in aggregate, Typescript will have significantly more `features` than Scala 3.0, and they will have the benefit of being used and iterated upon for 2+ years.
Re:Towards Scala 3 by coryfklein on Friday April 20, 2018 @05:11PM (#16888463)
Like many things, the utility of a language can actually decrease as you add more things on to it. Both Scala and Go take a principled approach of only accepting heavily vetted features.

The time it takes to develop a feature is very rarely the bottleneck.

Re:Towards Scala 3 by threeseed on Friday April 20, 2018 @06:53PM (#16888970)
There are developer releases through 2019 as well.

So it's not like it won't be used until 2020.

Re:Towards Scala 3 by vbezhenar on Friday April 20, 2018 @01:30PM (#16886724)
That's my negative point about Kotlin (sorry, offtopic here, but stil). It moved fast before release and now for a long time there were only very minor releases (well, coroutines were nice addition and that's all) despite the fact that there's a lot to improve in Kotlin.