Making immutable instances

Mike Meyer mwm at mired.org
Fri Dec 2 01:18:55 CET 2005


Paul Rubin <http://phr.cx@NOSPAM.invalid> writes:
> Mike Meyer <mwm at mired.org> writes:
>> Lots of people seem to want immutable instances. Nobody seems to have
>> a use case for them.
> What is the use case for immutable strings?  Why shouldn't strings be
> mutable like they are in Scheme?

I don't know. Why shouldn't they?

> Generally if I know I don't plan to mutate something, I'd want to make
> it immutable so the runtime system can notice if I make an error.
> It's like an "assert" statement spread through the whole program.

That's not a use case, that's a debugging aid. The same logic applies
to adding type declarations, private/public/etc. declerations, and
similar B&D language features. It's generally considered that it's not
a good enough reason for adding those, so it doesn't really constitute
a good enough reason for making an instance immutable.

  <mike
-- 
Mike Meyer <mwm at mired.org>			http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.



More information about the Python-list mailing list