News for hackers. Stuff that matters.
Re:Reasonable Scala Compiler by koolba on Friday August 18, 2017 @09:03AM (#15045704)
It's also atrocious for comprehension.
Re:Reasonable Scala Compiler by lmm on Friday August 18, 2017 @09:41AM (#15046008)
Not the same thing. The thing that slows down compilation is recursively derived implicit parameters for typeclasses, which don't tend to be a problem for reading - you just write "myObject.toJson" (and behind the scenes it recurses through the structure of myObject at compile time, ensuring that all of the nested types bottom out in values that can actually be serialized to JSON, and compiles to something of similar efficiency to manually naming all the fields). The thing that causes readability issues tend to be overuse of implicit conversions, and the community has largely moved away from that, thankfully.
Re:Reasonable Scala Compiler by harveywi on Friday August 18, 2017 @10:23AM (#15046422)
This is interesting. Would it be helpful, and possible, to add a "YOLO mode" to the Scala compiler so that it just make-believes that recursively derived implicit parameters bottom out properly? Maybe force the caller to give an explicit type (even if the type is wrong). I'd do that to reacquire some semblance of quick compile times.

Then, when the developer has finished they can switch off "YOLO mode" and start playing whack a mole with the types, as needed, punctuated by longer compilation times.

Re:Reasonable Scala Compiler by lmm on Friday August 18, 2017 @10:48AM (#15046656)
> This is interesting. Would it be helpful, and possible, to add a "YOLO mode" to the Scala compiler so that it just make-believes that recursively derived implicit parameters bottom out properly?

It's not possible to actually build, because at the end of the day you are (presumably) using the implicit for something (e.g. JSON-serializing the value). You could explicitly pass ??? where the implicit is wanted to get a runtime failure where it's used. I guess it might be possible to have tooling do that "magically", but I'm not sure how useful that would be; if you're working on that particular area you can use ??? by hand, if you're not working on that area then you presumably won't be rebuilding it since you're presumably using incremental compilation anyway.

What is possible is to fail-fast when resolution fails, and not check for duplicates when resolution succeeds - one main reason for the blowup is that at every stage of recursive resolution you have to check whether the implicits were ambiguous. There's a proposed fix for that piece: https://github.com/scala/scala/pull/5649

Re:Reasonable Scala Compiler by koolba on Friday August 18, 2017 @10:28AM (#15046466)
Typescript is kind of like that. You can run the compiler with the type validations disabled. That can lead to potentially broken code but it can also be significantly faster than waiting for all type checks to complete.
Re:Reasonable Scala Compiler by smitherfield on Friday August 18, 2017 @11:21AM (#15046973)
But if you do that you’re just writing JavaScript with pointless added verbosity and significant complexity pointlessly added to your toolchain.
Re:Reasonable Scala Compiler by koolba on Friday August 18, 2017 @11:42AM (#15047155)
The idea is to have fast compilation most of the time (local dev) and slower/full compilation during the "real" build.

Here's a testing analogy: My CI server runs all tests, every time. My local machine only runs the ones I tell it to run as if I change one small piece of an app then I'm not going to wait for the entire test suite to run.

Re:Reasonable Scala Compiler by smitherfield on Friday August 18, 2017 @03:10PM (#15048929)
And the incremental compilation isn't fast enough for you? Plus building Angular 2 (hundreds of thousands of LoC) takes only a few seconds.
Re:Reasonable Scala Compiler by jghn on Friday August 18, 2017 @11:37AM (#15047107)
Depends completely on how the implicits are being used. The older form of implicit conversions are pretty rough, but the more modern trend towards implicit enhancement IMO can improve readability.
Re:Reasonable Scala Compiler by devdoomari on Friday August 18, 2017 @12:05PM (#15047360)
that can be mitigated with IDEs showing marks on implicit uses, with mouse-over-to-peek-definition features (hope this lands on intelliJ... and hopefully a free license for me lol)