Re: Distinguishing case class members

Sébastien Doeraene <[email protected]> Thu, 14 Jan 2016 00:50:39 +0100
Newsgroups gmane.comp.lang.scala
Message-ID <CAJwkOg6bKvdrqR-6o92Y-rJWgxQdS+7Gof-W2kH443GQrYKJ2A@mail.gmail.com>
Hi,

Because it is usually a bad thing for `x == y` to change over time. If your
case class is mutable, its auto-generated `equals` will cause `x == y` to
to behave differently during the life of `x` and/or `y`. Mutable classes
should always have reference equality, i.e., `x == y` if and only if `x eq
y`, otherwise you break referential transparency, one of the most useful
properties of functional programming.

Cheers,
Sébastien

On Wed, Jan 13, 2016 at 11:50 PM, Oliver Ruebenacker <[email protected]>
wrote:

>
>      Hello,
>
>   Why are mutable case classes bad?
>
>      Best, Oliver
>
> On Wed, Jan 13, 2016 at 5:22 PM, Seth Tisue <[email protected]> wrote:
>
>> in this vein, see also Rüdiger Klaehn's answer at
>> http://stackoverflow.com/a/34719624/86485 ("People frequently use case
>> classes and then try to customize/abuse them to do something else than what
>> case classes are supposed to do...")
>>
>> --
>> 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.
>>
>
>
>
> --
> Oliver Ruebenacker
> Senior Software Engineer, Diabetes Portal
> <http://www.type2diabetesgenetics.org/>, Broad Institute
> <http://www.broadinstitute.org/>
>
> --
> 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.
>

-- 
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.