Closed pablisco closed 2 years ago
We can support value class copy constructors in two ways:
We can add a very simple copy constructor:
value class Temperature(val value: Int) fun Temperature.copy(block: (Int) -> Int): Temperature // usage val newTemp = temp.copy { it + 1 }
When making a copy of a type that we have generated copy/transform functions, we can avoid the user having to reference the single value in the type.
This may need more thinking and potentially make it opt-in (at least initially)
We can support value class copy constructors in two ways:
Copy constructor:
We can add a very simple copy constructor:
Nested copy
When making a copy of a type that we have generated copy/transform functions, we can avoid the user having to reference the single value in the type.
This may need more thinking and potentially make it opt-in (at least initially)