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

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



I've fixed this.

the reason was a bug in the error handling within Function:protect (in prTry)
Since "use" uses protect, your example failed, too.

simplest example:

e = (rout: r { 1 + nil });
e.rout.next; // ok

e = (rout: r { 1 + nil });
use { e.rout.next; } // no error


e = (rout: r { 1 + nil });
protect { e.rout.next; } // no error






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

: <mailto:jamshark70@xxxxxxxxxxxxxxxxx>jamshark70@xxxxxxxxxxxxxxxxx

: <http://www.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



_______________________________________________
Sc-devel mailing list
Sc-devel@xxxxxxxxxxxxxxx
http://www.create.ucsb.edu/mailman/listinfo/sc-devel


--





.