Leon K
01/24/2020, 4:46 PMautoDSL
, a library based on annotation processing that can automatically generate a dsl-style builder for your classes, which is simmilar to what i want, but is rather inelegant, and a library needing kapt - hurting compile-times
What would you think about some kind of language-feature that allows for easier building of immutable (data)-classes, like some kind of buildable
class modifier?
I could imagine it being a way to specify that a data-class has some buildable
fields, that are, as long as the class has not been built, mutable (and also might include building
-functions, that are only present whilst the object hasn't been built.
the modifier could then introduce a new method create
which turns the buildable class-instance into the normal, immutable data-class instance that you would then use everywhere.
this would, in a way, be a way of combining a builder class together with it's fully built, immutable version. for simple data-container-classes, this could be really practical
any thoughts?Leon K
01/24/2020, 4:49 PM?
?
also, would this be worth it and even desirable? it would really only make sense for truly immutable, data-container-only classes that don't contain any side-effecty functionsHanno
01/24/2020, 6:27 PMLeon K
01/24/2020, 6:29 PMHanno
01/24/2020, 7:23 PMjimn
01/27/2020, 2:00 AMjimn
01/27/2020, 2:01 AMjimn
01/27/2020, 2:02 AMraulraja
01/30/2020, 8:15 PM