Newsgroups: comp.lang.smalltalk
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!howland.reston.ans.net!pipex!uknet!festival!olly
From: olly@festival.ed.ac.uk (O Morgan)
Subject: passing variables into blocks
X-Newsreader: TIN [version 1.1 PL8]
Message-ID: <D5qnGH.5JC@festival.ed.ac.uk>
Organization: Edinburgh University
Date: Mon, 20 Mar 1995 12:17:01 GMT
Lines: 24

Sorry, another newbie question.

In ST (Digitalk for Windows, version 2), is it possible to bind a
variable to a block variable.  For instance, if I wanted to pass a block
of code to a method, and instantiate the block variable to a specific
method variable.  Eg:  I pass  [ c| (c > 3) and: [c < 8 ] ] as a
parameter to method test:, below.  The question is, is there anything
equivalent to 'do:' which could 'iterate' an object.  I know I could put
the object into a collection first, but I'd like to do it directly.

test: aBlock
     | someVariable |
      someVariable:= 1.  
      ^someVariable doObject: aBlock

Thanks for any help.

PS can anyone recommend a good book for ST/V, I've reached the stage
where I need more than the Digitalk tutorial.

Thanks for any help.


Olly Morgan
