4 ms·
I dabbled with it about six months ago. I write most of my software in Scala, but I continue to hit the ceiling and run into places where type inference fails,
by harveywi 10y ago
I dabbled with it about six months ago. I write most of my software in Scala, but I continue to hit the ceiling and run into places where type inference fails, compiler bugs add friction, or other oddities (22-tuple limit) get in the way. One of my experiments was to see if I could write some portions of my software in Frege, and some in Scala to get the best of both worlds.
I think the answer that to that question appears to be yes [1], but I stopped experimenting. I am considering resuming my experiment now that Frege appears to be crystallizing a bit more.
The java interop is nice, albeit it imposes discipline (as it should). Since java doesn't care about side effects, most of the values returned from a java function call will be in a Mutable monad. Here [2] is a good walkthrough for how it is done in case you want to try it out.
[1] https://groups.google.com/d/topic/frege-programming-language/vy_fR3bNYrA/discussion https://groups.google.com/d/topic/frege-programming-language...
[2] http://mmhelloworld.github.io/blog/2013/07/10/frege-hello-java/ http://mmhelloworld.github.io/blog/2013/07/10/frege-hello-ja...
- premium-concern 10y agoDo you have some examples for "type inference fails"? Do you have some examples for "compiler bug"?
- harveywi 10y agoHere is a quick shortlist of some type inference issues (some bugs, some enhancements, and some fundamental limitations of the language design) that I run into pretty much daily: 1. (Search for "asInstanceOf"): http://typelevel.org/cats/tut/freemonad.html http://typelevel.org/cats/tut/freemonad.html 2. (Finally fixed and will hopefully be released soon - yay!): https://issues.scala-lang.org/browse/SI-2712 https://issues.scala-lang.org/browse/SI-2712 3. https://twitter.com/extempore2/status/430456002392391681 https://twitter.com/extempore2/status/430456002392391681 4. http://pchiusano.blogspot.com/2011/05/making-most-of-scalas-extremely-limited.html http://pchiusano.blogspot.com/2011/05/making-most-of-scalas-... 5. (Anecdotal): Various pattern matching peculiarities. Compiler bugs: As long as I write code on the happy path and steer clear of scalaz/shapeless/cats, the compiler is pretty well-behaved and I can go months without getting a compiler crash. However, when I add those in and start writing pure functional code with complicated types that hits the intersections of various features (e.g., GADTs, package objects, implicits), I get a few crashes per week related to known bugs. It works pretty well, and I am not trying to complain too much about all the mileage I get out of Scala and the excellent tooling! Just trying to get the most out of it.
- premium-concern 10y ago> I get a few crashes per week related to known bugs Interesting! Can you link to the issue?
- harveywi 10y agoSure, you bet - I will start collecting them as they occur. However, I no longer find new bugs, it seems. I'll break something, google for the error message, and either find something on issues.scala-lang.org, IRC, or one of the Google Groups. My current code base is not open-source just yet, so reporting self-contained reports may not be possible. (Currently I'm writing an interpreter for a fairly big declarative language using FreeApplicative from cats as the substrate, and I think the sheer size of it along with shapeless and scalaz usage is causing some undesirable feature interactions. Where would be the best venue for reporting (known) bugs? Is there any value if I can't provide the actual code? Or is just reporting a "I experienced it too" message valuable?
- premium-concern 10y agoI think this would help a lot. It would also help to check whether the code mentioned in an issue that triggers a crash is equivalent to the code you have. Even if you can't publish your code, it might help to say "I'm seeing the same error, but I'm using X unlike the exmaple code that uses Y". This will make sure that people who fix a bug will cover both causes with a test.
- harveywi 10y agoHere is a new one that I reported to scala-internals today: https://groups.google.com/forum/#!topic/scala-internals/w4HGp4_QQwk https://groups.google.com/forum/#!topic/scala-internals/w4HG...
- premium-concern 10y agoGreat, thanks!