CLOVIS
02/10/2021, 8:20 AMvalue class
and it sounds like something Arrow would be really interested in (immutable classes that have mutators that return copies). Do you have plans to use these features? They seem to clash with Lens, but maybe they could work well together?Satyam Agarwal
02/10/2021, 8:26 AMsimon.vergauwen
02/10/2021, 9:44 AMsimon.vergauwen
02/10/2021, 9:45 AMvalue class
is absolutely something we're interested in! And the deep mutation part does seem to clash a bit with the Optics DSL but it might also served as an inspiration point I think. The Optics DSL has been discussed several time with some JB people.
If there is a better solution in Kotlin, we'll just deprecate the Arrow variant in favor of the Kotlin way of doing this.okarm
02/10/2021, 12:43 PMsimon.vergauwen
02/11/2021, 9:17 AMCLOVIS
02/11/2021, 11:41 AMsimon.vergauwen
02/11/2021, 12:28 PMCLOVIS
02/11/2021, 3:04 PMjulian
02/11/2021, 5:04 PMCLOVIS
02/11/2021, 6:02 PMvalue
keyword and the JvmInline
annotation. I don't think we'll see value classes soon, but it's really interesting to know what they are thinking about.simon.vergauwen
02/12/2021, 9:05 AMsimon.vergauwen
02/12/2021, 9:07 AMvalue class
or also data class
and sealed class
. Will this also include special support for things like kotlin.collections
etc.
I think we'd have to sacrifice the compositional properties of Optics for promoting this instead as well.simon.vergauwen
02/12/2021, 9:08 AMsimon.vergauwen
02/12/2021, 9:08 AMCLOVIS
02/12/2021, 10:13 AMvalue class
because of ambiguities. The only issue I think is that the migration of List
etc is going to be complicated, if at all possible (they touch on this as well).
They also mention a AnyValue
type that would be the common ancestor to all value class,
I wonder where it should be positioned compared to Any
? Mathematically it should probably be above it (since Any = AnyValue + identity
) but that sounds like it could break some code? Also, having AnyValue
as a parameter wouldn't allow the compiler to copy objects in all cases...simon.vergauwen
02/12/2021, 10:43 AMAnyValue
that seems very Scala like I'm quite surprised about that 😅 A bit weird this feature would be for value class
only since data class
suffers from the exact same problem they explain in their rationale.simon.vergauwen
02/12/2021, 10:43 AMCLOVIS
02/12/2021, 11:31 AMdata class
(we would only use them for mutable data, which in theory should be fairly rare).
It sounds like it could work very well when it's implemented, but the migration sounds like a ton of work, it's a big step for the language.CLOVIS
02/12/2021, 11:32 AMCLOVIS
02/15/2021, 9:02 AMfreeze
problem: what if they made it so you can only share value classes
between threads? Then, it would be a compile-time feature, and not a runtime feature.simon.vergauwen
02/15/2021, 10:12 AMvalue classes
that the JVM doesn't restrict. I'd love it but not sure if everyone would 😀CLOVIS
02/15/2021, 3:46 PMfreeze
exists” 🤔