Block evaluation from a collection of blocks

Jules Dubois de6l5rp02 at sneakemail.com
Mon Mar 22 08:16:32 UTC 2004


On Sun, 21 Mar 2004 22:23:40 -0800, Ned Konz wrote:

Thanks so much for your help.  Your sample code works as 
advertised.  I've not quoted much of my original article 
or your reply.

> On Sunday 21 March 2004 9:30 pm, Jules Dubois wrote:
>> Setup: I'm trying to place a collection of blocks into
>>        a class variable for repeated evaluation in an
>>        instance method.
>>
>>             [:fwgc | FWGC f: fwgc f change
>>                           w: fwgc w
>>                           g: fwgc g
>>                           c: fwgc c]
>> [ad nauseum]
>>
>> I get an error saying "This block requires 0 arguments".  Don't these
>> blocks take 1 argument?
> 
> Sure looks like they do.

The blocks in my source code seemed like they should but my Smalltalk
experience is limited to the last ten days.  The class variable must
have been holding references to old blocks.  I had changed the 
implementation of the blocks, followed by deleting the class
variable and recreating it.  My method seems to be ineffective in
clearing the value of the variable.

Installing (into my image) and invoking this method from your sample code

    clearMoves
        Moves _ nil

fixed that problem.  (Immediately I discover I'm writing LISP-style code
-- nil is false and everything else is true -- in some other methods and
it doesn't work in Smalltalk.  I've learned LISP, ML, PROLOG, and Python
in the last eight months and I can't keep them straight.)

>>    Moves select: [:move | move value validate]
>>
>> In this case, it appears the 'f:w:g:c:' message is being sent to the FWGC
>> class and not the fwgc instance in which the statement is bing executed.
> 
> Well, 'self' in that case would be referring to thc class, so that's not what 
> you want to do.

After considering your reply, it seems rather obvious.

> What version of Squeak are you using?

I would have sworn I was running v3.6 but I guess not.

    $ squeak -version
    3.4-1 #1 XShm Tue Mar  4 05:30:53 CET 2003 gcc 2.95.4
    Squeak3.4 of 1 March 2003 [latest update: #5170]
    Linux xombul.inria.fr 2.4.19 #2 Mon Aug 5 12:44:11 CEST 2002 i686 GNU/Linux
    default plugin location: /usr/local/lib/squeak/3.4-1/*.so

    $ find /usr -name "Squeak*image" -print
    /usr/local/lib/squeak/Squeak3.6-5424-full.image

It seems I have a v3.4 executable and a v3.6 image.  So, I have two more
questions:

   Are there good reasons for trying v3.6g2 on a Linux system?

   Is source code portable between two minor versions (possibly
   v3.4 and v3.6, once the CS Department installs Squeak)?





More information about the Squeak-dev mailing list