[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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



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@xxxxxxxxxxxxxxxxx

: http://www.dewdrop-world.net

.::!:.:.......:.::........:..!.::.::...:..:...:.:.:.:..:


"Come said the Muse,

Sing me a song no poet has yet chanted,

Sing me the universal."  -- Whitman