Newsgroups: comp.lang.smalltalk
Path: cantaloupe.srv.cs.cmu.edu!europa.chnt.gtegsc.com!news.mathworks.com!uhog.mit.edu!bloom-beacon.mit.edu!news.tamu.edu!news.utdallas.edu!corpgate!bcarh189.bnr.ca!nott!newbridge.com!newshost.newbridge.com!NewsWatcher!user
From: Jan.Bytesmiths@acm.org
Subject: Re: Smalltalk formatting styles...
Message-ID: <Jan.Bytesmiths-0405951935430001@138.120.62.117>
Sender: usenet@Newbridge.COM
Reply-To: Jan.Bytesmiths@acm.org
Organization: Bytesmiths, a technical services company
References: <D7y4tp.Dp6@hplb.hpl.hp.com> <NEWTNews.11668.799517912.Postmaster@g3148074.ga.bst.bls.com> <499293728@to.mobil.com>
Date: Thu, 4 May 1995 23:35:43 GMT
Lines: 31

In article <499293728@to.mobil.com>, curt@to.mobil.com (Curt Welch - RDR) wrote:

> I think half the problem is that the syntax of Smalltalk sucks when it comes
> to control constructs.

After a while, you'll say that about C. The key is to remember: There *are
no control constructs* in Smalltalk! This is hard for procedural folks to
accept. Once you accept that, then you begin to format your "control
constructs" just like the messages they really are.

> But how do you do a clean if-elseif-elseif-else type construct?  You can't.

Perhaps *you* can't, because you're still reading C!

Please don't start the "case statement considered non-OO" thread again! At
that risk, this is how I like to see them:

   1 = switchVal ifTrue:
      [self doOneAction] ifFalse:
   [2 = switchVal ifTrue:
      [self doTwoAction] ifFalse:
   [3 = switchVal ifTrue:
      [self doThreeAction] ifFalse:
   "switchVal isAnythingElse ifTrue:
      [self defaultAction]]]

It isn't C, but it reads.

 Jan Steinman, Bytesmiths <Jan.Bytesmiths@acm.org>
 2002 Parkside Court, West Linn, OR 97068-2767 USA, +1 503 657 7703
 1025 Grenon #1002, Ottawa, Ontario K2B 8S5 Canada, +1 613 820 9919
