Conversation
| import scala.math.sqrt | ||
|
|
||
| val writer1: Writer[String, Double] = Writer.value(5.0).tell("Initial value ") | ||
| val writer1: Writer[String, Double] = Writer.value[String, Double](5.0).tell("Initial value ") |
There was a problem hiding this comment.
This feels like a type inference regression from 2.12 -> 2.13.
There was a problem hiding this comment.
Yeah, seems so... I think it might be nice (in the future) to create a better version of Writer.value (and WriterT.value) with some sort of PartialApply involved which would allow to write something line this:
val writer1 = Writer.value[String](5.0).tell("Initial value ")
There was a problem hiding this comment.
Agree, we can do it bincompatibly probably but it would be source-breaking...
|
|
||
| ```scala mdoc | ||
| try { | ||
| allFalse.foldRight(true)(_ && _) | ||
| } catch { | ||
| case e:StackOverflowError => println(e) | ||
| } | ||
| ```scala | ||
| // beware! throws OutOfMemoryError, which is irrecoverable | ||
| allFalse.foldRight(true)(_ && _) | ||
| ``` |
There was a problem hiding this comment.
This seemed to throw OutOfMemoryError instead of StackOverflowError on my machine. Maybe in 2.13 they made it stack-safe?
Problem is, unlike StackOverflowError, I believe an OutOfMemoryError is irrecoverable, so a try/catch here only leads to problems arising elsewhere in the JVM. At least that's what I was observing locally.
There was a problem hiding this comment.
Just to save time for other curious readers :)
Specialized implementation of reverse in LazyList in Scala 2.13 is now @tailrec
https://github.com/scala/scala/blob/bfe46ae4da6401a62c83b728561d6bc7d1b3467b/src/library/scala/collection/immutable/LazyList.scala#L735
Co-authored-by: Arthur S. <36887373+arixmkii@users.noreply.github.com>
|
@arixmkii thank you!! |
|
Politely requesting review from Sergey since we discussed this in #4160 (comment). No rush, whenever you have a chance, thanks! |
|
@satorg polite ping on this? :) |
|
@armanbilge oops, sorry, missed this one |
Closes #4229.
Edit: Apparently also fixes #4041