Newsgroups: comp.lang.smalltalk
Path: cantaloupe.srv.cs.cmu.edu!rochester!udel!delmarva.com!newsfeed.internetmci.com!news.mathworks.com!tank.news.pipex.net!pipex!uknet!newsfeed.ed.ac.uk!festival!olly
From: olly@festival.ed.ac.uk (O Morgan)
Subject: passing array values in aBlock parameter.
X-Newsreader: TIN [version 1.1 PL8]
Message-ID: <DE12CM.3Hp@festival.ed.ac.uk>
Organization: Edinburgh University
Date: Mon, 28 Aug 1995 15:43:33 GMT
Lines: 36

I am writing a method where a block of code, which tests for certain
conditions, is passed to the invoked method.

The test will be executed in the invoked method with a value statement
 aBlock value: aParm. 

How can I ensure, that when I pass a block of code as a parameter, that
the elements within that code, pass as values, rather than variable
names. 

eg:
if 'groups' is an array defined locally in the calling method, and I
have the following line, for which the invoked method will supply a
parameter (a):

matrix selectRowsWhere: [:a | a> (groups at:3)].

I want to ensure that the (groups at:3) bit is instantiated to the third
item in the groups array before the block is passed as a parameter,
rather than being passed as text, which would be instantiated to
variables in the selectRowsWhere: method. 

I assume currently that the invoked method is trying to find a local
variable called 'groups'.  The code is not failing outright, but the
method is not working.  When I use the debugger I cannot access the
code. 

Is there a way of ensuring that any references to (calling method)
structures within the block (parameter to invoked method) are
instantiated before it is passed?

I hope this message is not too incomprehensible, and if anyone can help
me on this, I would be most grateful.  I am using Digitalk ST-V for
windows, version 2.0

Olly Morgan
