Re: Why don't stringobjects have methods?

Jaap Vermeulen (jaap@sequent.com)
Fri, 1 Apr 94 16:49:52 GMT

In <2ng5vt$fj3@hopscotch.ksr.com> tim@ksr.com (Tim Peters) writes:

>The interesting question is _why_ strings and tuples (etc) are immutable,
>and I don't have an interesting answer to that. Maybe Guido will shed
>more light on these decisions?

I can give you a simple reason:

If strings were mutable any hashing based on strings would become very
tricky. That's why dictionaries don't support lists as keys (or any
mutable object for that matter).

It's not impossible (see Smalltalk), but that would certainly guarantee
some unexpected behavior somewhere down the line. With the current
approach you keep all behavior predictable without really loosing any
functionality.

-Jaap-

-- 
Jaap Vermeulen					+--------------------------+
						| Sequent Computer Systems |
	Internet : jaap@sequent.com		| Beaverton, Oregon	   |
	Uucp	 : ...uunet!sequent!jaap	+--------------------------+