Squeak
  links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
Origin of curly braces in Squeak
Last updated at 9:22 pm UTC on 28 February 2017
copied from http://www.cc.gatech.edu/fac/mark.guzdial/squeak/notes/curlybraces.html

Resent-Date: 17 Dec 1997 04:58:51 -0000
Resent-Cc: recipient list not shown:;
Subject: Re: New comment delimiter?
Date: Tue, 16 Dec 97 22:57:51 -0600
From: Tim Olson 
To: 
Mime-Version: 1.0
Resent-From: squeak@cs.uiuc.edu
Reply-To: squeak@cs.uiuc.edu
X-Mailing-List:  archive/latest/43
X-Loop: squeak@cs.uiuc.edu
Precedence: list
Resent-Sender: squeak-request@cs.uiuc.edu
Status:   

David N. Smith wrote:

>(3a) Curly braces alone, which conflicts with something in some system >(possibly SmalltalkAgents??):

Curly braces are currently used in Squeak to construct runtime-evaluated collections and to implement multiple-value assignment. For those of you who may not have seen it, Squeak allows you to do the following:

1) Runtime-evaluated Collection Brace stacks can be used to create runtime-evaluated arrays almost as easily as literal arrays:

{a. b-3. c squared}

is equivalent to:

Array with: a with: b-3 with: c squared

any type of collection can be used by adding an as: message:

{a. b-3. c squared} as: OrderedCollection

2) Multiple value assignment Brace stacks on the left-hand-side of an assignment can be used to assign multiple values in parallel:

{a. b} := #(1 2). "a := 1. b := 2" {a. b} := {b. a}. "swap"

3) caseOf: statements One of the uses of 1) above is in building a runtime collection of block associations for caseOf: statements:

stateMachineState caseOf: { [1] -> [(firstByte << 2) bitOr: (secondByte >> 6)]. [2] -> [(firstByte << 6) bitOr: (secondByte >> 2)]}.

-- tim

Resent-Date: 17 Dec 1997 19:15:38 -0000 Resent-Cc: recipient list not shown:; X-Sender: dani@bobo.rd.wdi.disney.com Mime-Version: 1.0 Date: Wed, 17 Dec 1997 11:15:05 -0700 To: squeak@cs.uiuc.edu From: Dan Ingalls Subject: Re: Meaning of Curly Braces (was Re: New comment delimiter?) Resent-From: squeak@cs.uiuc.edu Reply-To: squeak@cs.uiuc.edu X-Mailing-List: archive/latest/58 X-Loop: squeak@cs.uiuc.edu Precedence: list Resent-Sender: squeak-request@cs.uiuc.edu Status:

>>Has this always been in ST-80, >>or is it new to Squeak? > >I think it was added in Squeak, but I don't know the story behind it.

Larry Tesler added the Curly Brace construct to Apple Smalltalk back around 1985, and there it sat in Apple's APDA (Apple Programmer and Developer Association) Smalltalk release for about a decade. Then we resurrected that image as the basis of Squeak, and I've never bothered to tear it out. I never (well hardly ever) use it, but it's occasionally convenient as an answer to the complaint that ST does not have case statements ;-).

My personal feeling is that it doesn't really carry its weight as another feature that needs to be documented, and maintained. Whenever we make a compiler or decompiler change, it seems that it breaks braces, but we don't notice or hear about it for a month because almost noone uses them. Also, it is incompatible with every other Smalltalk.

- Dan