On 12 July 2012 17:40, Sean P. DeNigris <sean@clipperadams.com> wrote:
Sven Van Caekenberghe wrote
But do you agree that the only solution is to use a dynamic variable ? Because signalling code has to known whether there is someone catching the notifications, right ?
Could you say more about that? Googling "dynamic variable" turned up academic stuff. Also, could Announcements be helpful here?
You've used them all the time: they're just like (shell) environment variables, only the environment variables can nest. So in a default Squeak image (which has the DynamicVariables package by default), MyDynVar value: 1 during: [ Transcript showln: (MyDynVar value printString). MyDynVar value: 2 during: [ Transcript showln: (MyDynVar value printString). ]. Transcript showln: (MyDynVar value printString). ] will output 1 2 1 There is a gotcha with naively implementing dynamic variables: they _do not_ play nicely with delimited continuations: http://www.lshift.net/blog/2012/06/27/resumable-exceptions-can-macro-express... shows a solution which should Just Work in Pharo ( and if it doesn't, let me know, and I'll make it work). The link also has links explaining in detail why the two don't work nicely. This bad interaction will bite you as soon as you do anything interesting to the stack, and given that you always have thisContext just a reference away, that could be any time you like! Oh. I see I _didn't_ put a link to the code. Sigh. http://ss3.gemstone.com/ss/Control.html is the place to get the code. frank
Sean
-- View this message in context: http://forum.world.st/ENH-Zinc-Streaming-Download-Progress-tp4639686p4639695... Sent from the Pharo Smalltalk mailing list archive at Nabble.com.