[Sc-devel] Re: possible bug? weird situation with exception handling

James Harkins jamshark70 at gmail.com
Sat Nov 17 23:39:59 PST 2007


On Nov 17, 2007, at 7:30 PM, James Harkins wrote:
> I not sure how this could happen, but I ran into a situation just  
> now where an error thrown within a few layers of "protect" calls  
> somehow got swallowed, never reported -- where protect is always  
> supposed to rethrow.

I figured out how to reproduce this simply.

(
e = Environment.make({
	~strm = { 1+nil };
	
	~makeStream = { |self|
		self[\myStream] = Routine({
			var	stream, val;
			self.use({ stream = ~strm.value.asStream });
			{ (val = stream.next).notNil }.while({ val.yield });
		});
	};
	
	~pNext = { |self| self[\myStream].next };
}).know_(true);
)

e.makeStream;
e.use({ e.pNext; });

e.makeStream;
protect { e.pNext };

The 'use' or 'protect' lines should throw back the error resulting  
from 1+nil, but they don't. They just return nil.

Is this a bug, or just something I don't understand about different  
threads' interaction with error handling?

hjh


: H. James Harkins
: jamshark70 at dewdrop-world.net
: http://www.dewdrop-world.net
.::!:.:.......:.::........:..!.::.::...:..:...:.:.:.:..:

"Come said the Muse,
Sing me a song no poet has yet chanted,
Sing me the universal."  -- Whitman

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.create.ucsb.edu/pipermail/sc-devel/attachments/20071117/3553cf7c/attachment.htm


More information about the Sc-devel mailing list