Re: immutability is not strictly the same as having an unchangeable value, it is more subtle

2019-04-18 Thread Chris Angelico
On Thu, Apr 18, 2019 at 6:16 PM Gregory Ewing wrote: > > Arup Rakshit wrote: > > What protocols I need to > > learn, to define a custom immutable class ? > > That depends on how strictly you want to enforce immutability. > > The easiest thing is not to enforce it at all and simply refrain > from m

Re: immutability is not strictly the same as having an unchangeable value, it is more subtle

2019-04-18 Thread Gregory Ewing
Arup Rakshit wrote: What protocols I need to learn, to define a custom immutable class ? That depends on how strictly you want to enforce immutability. The easiest thing is not to enforce it at all and simply refrain from mutating it. This is very often done. You can provide some protection a

Re: immutability is not strictly the same as having an unchangeable value, it is more subtle

2019-04-17 Thread Arup Rakshit
Hi All, Thanks for explaining it so nice way. I got it now. What protocols I need to learn, to define a custom immutable class ? Thanks, Arup Rakshit a...@zeit.io > On 16-Apr-2019, at 10:54 PM, Dennis Lee Bieber wrote: > > On Tue, 16 Apr 2019 13:13:18 +0530, Arup Rakshit declaimed the >

Re: immutability is not strictly the same as having an unchangeable value, it is more subtle

2019-04-16 Thread Chris Angelico
hat contains a reference to a mutable object can change when the latter’s > > value is changed; however the container is still considered immutable, > > because the collection of objects it contains cannot be changed. So, > > immutability is not strictly the same as having an unch

immutability is not strictly the same as having an unchangeable value, it is more subtle

2019-04-16 Thread Arup Rakshit
tainer is still considered immutable, because the collection > of objects it contains cannot be changed. So, immutability is not strictly > the same as having an unchangeable value, it is more subtle.) An object’s > mutability is determined by its type; for instance, numbers, strings and