Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!utgpu!water!watmath!clyde!cbosgd!ihnp4!ptsfa!ames!ucbcad!ucbvax!decvax!tektronix!tekcrl!tekchips!stevev
From: stevev@tekchips.UUCP
Newsgroups: comp.lang.smalltalk
Subject: Re: literals
Message-ID: <1418@tekchips.TEK.COM>
Date: Mon, 6-Jul-87 14:40:49 EDT
Article-I.D.: tekchips.1418
Posted: Mon Jul  6 14:40:49 1987
Date-Received: Thu, 9-Jul-87 03:24:22 EDT
References: <938@argus.UUCP> <740@unc.cs.unc.edu>
Organization: Tektronix Inc., Beaverton, Or.
Lines: 24
Keywords: literals methods
Summary: immutable classes

In discussing problems have a user modifying an object that is used
as a string literal ...

In article <740@unc.cs.unc.edu>, rentsch@unc.cs.unc.edu (Tim Rentsch) writes:
> 
> literals
> are still very useful, and I can't immediately suggest anything
> better.  Any ideas?

I see two possibilities:
  * Have the compiler generate code to make a copy of any string literal
    whenever it is accessed.  This obviously slows things down.
  * Define both mutable and immutable versions of String (and Array) and
    have the compiler produce immutable ones to represent literals.

The latter does not address the problem of a programmer using
"instVarAt:put:" or "become:", but I see that as a different issue:
the language does not have the facility to hide "dangerous" operations
from the programmer.

		Steve Vegdahl
		Computer Research Lab
		Tektronix Labs
		Beaverton, Oregon