so i guess my best bet is to promote it to a regul...
# announcements
g
so i guess my best bet is to promote it to a regular function, and wrap its body in an
apply
or
with
block.
Copy code
class Version1{

  fun consumer(){
    val model = MyDomainModel();
    model.doStuff();
  }
  
  MyDomainModel.DoStuff(){
    field1 = value;
    fiedl2 = value2;
  }
}
becomes
Copy code
Extensions{
  fun doStuff(model: DomainModel){
    with(model){
      field1 = value
      field2 = value2
    }
  }
}

Version2{
  val extensions = Extensions();
  val model = MyDomainModel();
  extensions.doStuff(model);
}