Sth like: ``` private inline fun updateRegistrati...
# announcements
p
Sth like:
Copy code
private inline fun updateRegistrationState(update : RegistrationState.()->RegistrationState){
    registrationState = update(registrationState)
  }
I would like to call it as:
updateRegistrationState { gender = Gender.MALE }
instead of
updateRegistrationState { copy(gender = Gender.MALE) }
g
I don’t think so
s
Why dont you just make
RegistrationState
mutable ? ie:
Copy code
private inline fun updateRegistrationState(update : RegistrationState.()->RegistrationState){
    registrationState = registrationState.copy().update()
  }
p
Because I hate mutability
s
Nothing wrong with mutability in a builder. If you expose
RegistrationState
elsewhere then maybe have a
MutableRegistrationState : RegistrationState
only for use in the builder ?
e
đź‘‹ 2