Frank I was asked to do a keynote to master, phd student and other and I would like to show them that with the right tool we can do some powerful abstractions. I'm thinking showing them thisContext use for haltIf on:fork: example do you have idea? Should I look (I will ;)) look at Control and DynamicVariable? Do you have other idea? Stef On Oct 13, 2012, at 5:54 PM, Frank Shearar wrote:
On 13 October 2012 15:47, Damien Cassou <damien.cassou@gmail.com> wrote:
I'm looking for a piece of code that is hard to understand by looking at the source code but which has unit tests that help understanding the behavior.
Do you have any idea?
http://ss3.gemstone.com/ss/Control/ has tests for delimited dynamic variables. The idea's not terribly complicated - close over a variable and use resumable exceptions to refer to it or change it - but if you don't have that in-a-nutshell idea in your head it can look a bit strange. But the tests in ControlTests' DelimitedDynamicVariableTest show quite clearly how dynamic binding works.
(The delimited part probably won't make a lot of sense until one's managed to wrap one's head around control operators - shift, in this case - so the nice interaction between the delimited continuations and the delimited dynamic variables might be lost on a newbie.)
frank
-- Damien Cassou http://damiencassou.seasidehosting.st
"Success is the ability to go from one failure to another without losing enthusiasm." Winston Churchill