links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
Block Closure Semantics (obsolete)
Last updated at 6:07 pm UTC on 19 July 2013

This is obsolete; full Closures are part of the main image

Also see Squeak Central project Closures, the recently complete version by Anthony Hannan, Closures and Are Squeak blocks like Scheme blocks.


I've stopped working at this project: so ToDo probably remains forever.


Though there is the BCS implementation from Anthony Hannan now, I've decided to bring my own approach to a working state: here it is!

Though I haven't taken a deeper look into Anthony's BCS implementation so far - no time! - I assume - from what I've seen at the ML and the Swiki - that it is the conceptual better one.

This is a quick'n'dirty implementation, but it isn't as quick and as dirty as this sentence may suggest... Quick'n'dirty in the sense, that I've avoided to read much theory and tried to go my own way with some pressure of not spending too much time (in theory...).

Please read the Draft for Block Closure Semantics for Squeak if you want to understand what I have done. It closely corresponds to the current implementation; differences should be visible in the ToDo list.

Design goals

  1. as less new context classes as possible;
  2. reusing as much as possible;
  3. compatibility with old images;
  4. coexistence of non BCS and BCS blocks;
  5. semantic comes first, then implementation speed, runtime speed last.



All tests from ClosureTestCase-rww-bg are running OK.

Results with respect to the design goals

  1. Just one (!) more context class BCSBlockContext.
  2. The BCS compiler is weired, but hey, it works! I'm not very happy with the many stacks introduced in BCSEncoder; there should be a better way: they are used to avoid additional passes of the parse tree.
  3. The BCS VM runs without problems with standard images, as far as I've seen.
  4. Fulfilled.
  5. Fulfilled, but now it is almost as fast as the 3.2gamma VM (for classical BlockContexts).

The BCS VM is slightly slower for classical BlockContexts and probably slower for BCSBlockContexts (to be checked), since

When does it make sense to use it?

How to get it work


On top of the list is 'BCSDebugger: increase the visibility of BCS variables'.



I've started a long time ago with drafts for BCS. Some interesting comments of very experienced people suggested another implementation. Since I wanted to see if my ideas are working and did understand them better I followed them further. Then there has come the announcement of Anthony that he would work at an ambitious implementation. This demotivated me somewhat and work has stood still for a while. But it has taken time and time without visible code... Now I know why!
I've restarted again with this project and then Anthony's very concrete announcement for New Year has come followed by his code: Congratulations!
But in spite of this - and being aware of coming late ;-) - I decided to come to some end - I don't like long projects without any result - and to give the code to the masses...
As a personal result I have learned a lot, especially by the wrong paths which I've followed before coming to the correct ones.
And here it is.

Questions, wishes and comments

Add them here or mail to Stephan Rudlof.