Closed RustedBones closed 11 months ago
It bugs me in way I can't put to words that functions aren't serializable by default. In a FP language, they are very often class members, which prevents those classes from serialization. I do not understand why: if something shouldn't be Serializable
, then a non Serializable
object in function's closure will prevent serialization anyway.
Reproduction steps
Scala version: 2.12.17, 2.13.10 (works with scala 3.2.1)
Let's consider the following code
Problem
The execution fails with
I would expect the SAM type to be serializable, like in java.
I noted that if we change the
SerializableBiFunction
definition toThe code executes as expected and returns
true
.