Lexical closures in Squeak

Jason Dufair jase at dufair.org
Mon Aug 12 15:32:25 UTC 2002


With my recent venture into spawning Squeak processes, I have a 
question.  From having lurked on the list for many months, I am under 
the impression that Squeak's blocks are not true lexical closures (and 
that someone(s) are working toward this).  If this is true, then why 
does something like (forgive any errors - I'm going from memory)

StateMachine>>forkNextTrackProcess

   [ | delay |
    delay _ Delay forMilliseconds: 300.
    [terminating]
        whileFalse:
            [streamingMp3File samplesRemaining = 0
                ifTrue: [self nextTrack].
                Process waitFor: delay]] fork.

work?  'terminating' is an instance variable of StateMachine, by the 
way.  It would seem that this wouldn't be possible without true lexical 
closure.  I'm no CS major, so please speak slowly and avoid polysyllabic 
words :-)

-- 
Jason Dufair - jase at dufair.org
http://www.dufair.org/
"In matters of style, swim with the current; 
in matters of principle, stand like a rock."
-- Thomas Jefferson





More information about the Squeak-dev mailing list