Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!uunet!seismo!lll-lcc!ames!ucbcad!ucbvax!decvax!tektronix!tekcrl!tekchips!allenw
From: allenw@tekchips.TEK.COM (Brock)
Newsgroups: comp.lang.smalltalk
Subject: Re: literals
Message-ID: <1464@tekchips.TEK.COM>
Date: Thu, 16-Jul-87 18:26:29 EDT
Article-I.D.: tekchips.1464
Posted: Thu Jul 16 18:26:29 1987
Date-Received: Sat, 18-Jul-87 11:13:52 EDT
References: <938@argus.UUCP> <80500010@uiucdcsp> <805@unc.cs.unc.edu>
Organization: Tektronix Inc., Beaverton, Or.
Lines: 34
In article <805@unc.cs.unc.edu>, steele@unc.cs.unc.edu (Oliver Steele) writes:
> The other point is that code that does
> fee _ #(fi fo fum) copy.
> will expect fee to be mutable. I suspect I would have run into this if I
> had recompiled much of the system after changing Scanner. The only
> workaround I can see is to let Constant|copy be the same as
> Constant|as, but this is very misleading and changes the semantics
> of copy (copy no longer always returns an object of the same class).
> Comments?
>
> ------------------------------------------------------------------------------
> Oliver Steele ...!{decvax,ihnp4}!mcnc!unc!steele
> steele%unc@mcnc.org
>
> "They're directly beneath us, Moriarty. Release the piano!"
The use of the "species" message to determine what the class of a copy of a
ConstantArray should be might be appropiate. Alternately,
copy for a constant could be defined to return self (this
is what "immutable" objects (Symbol and Character) in
Smalltalk-80 currently do). The latter would result in
fee _#(fi ... above not doing what was intended.
The simplest answer to the issue raised above may be that Smalltalk
already has a syntax for accomplishing what was intended by the "fee"
expression. It is:
fee _ Array with: #fi with: #fo with: #fum.
Allen Wirfs-Brock
Software Productivity Technologies
Tektronix, Inc
allenw@spt.TEK.COM