Status of braces.

Alan Lovejoy sourcery at pacbell.net
Thu Jul 15 05:55:43 UTC 1999


> ** Original Sender: Chris Reuter <cgreuter at calum.csclub.uwaterloo.ca>
>
> Hi all,
> 
> A quick question.  Is the braces ("{" and "}") notation for
> constructing arrays from expressions deprecated?  I seem to remember
> reading something about that in this list but I don't recall what if
> any conclusions were reached.
> 

It must be about nine years ago I now that I first modified the ParcPlace
compiler.  I made it evaluate code between braces at compile time, and
insert the string value of the last statement eclosed by the braces as source
code to be compiled.

So, a method of the form:

someMethod
	"Some method comment"

	| filename stream |
	filename := {HostPlatform current isWindows
			ifTrue: ['c:\']
			ifFalse: ['./~']}, self relativePathString.
	stream := filename readStream.
	^[stream contents] ensure: [stream close]

would compile one way if the current HostPlatform is Windows, and a different way
if it's not.  I never used it much, though.

But I have always thought that syntax for specifying array literals that contain
expression values was needed.  The {} syntax seems as good as any.

--Alan


Download Neoplanet at http://www.neoplanet.com





More information about the Squeak-dev mailing list