ignorance: customizable immutables?
Raoul Duke <[email protected]>
| Newsgroups | gmane.comp.lang.scala |
|---|---|
| Message-ID | <CAJ7XQb44cpZzjUcbRGPohUPBq+JvaFVRH7axUN_wpGeizMRXVw@mail.gmail.com> |
> List(new A, new A{ override def foo = "different" }).map(x.asCapitalA)
> If `asCapitalA` has mutating side-effects, you retain the distinct `foo`
> behavior. If, in contrast, it creates a new immutable A, your unique `foo`
> behavior is lost.
Are there any approaches people like to use to get immutables that
respect whatever customization has been done -- some way to assemble
components and then still be able to frob() them and get a new
immutable copy that retains the customizations? Concisely, robustly? I
mean in any programming language.
--
You received this message because you are subscribed to the Google Groups "scala-language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.