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

[Sc-devel] enhancement: Have the compiler throw an error instead of just halting



Here is an annoyance that would be nice to fix by 3.2, though I don't
think it's necessarily critical.

If you try to compile a string programmatically that has a parse
error, execution halts -- whereas with every other kind of error, an
exception is thrown and you can catch it.

try { "_x".compile } { |error| "caught".postln; error.postln }

That's a trivial case, but the situation I'm trying to deal with is to
catch a SynthDef that cannot be properly made into a SynthDesc -- the
failure here is, because there are two Control UGens with the same
name, the msgFunc (built as a string) can't compile.

d = SynthDef(\xxx, { |abc = 1|
	var	abc2 = Control.names(\abc).kr(2);
	abc + abc2
});

try { d.memStore } { |error| "caught ".post; error.postln }

I can fix SynthDesc to throw an error in this case, but it occurs to
me that there might be other cases where you might be compiling code
programmatically, you don't have strict control over what that code
is, and you might want to catch compilation errors instead of watch
your app die.

I wanted to open a tracker bug, but this is really a feature request,
not a bug, and there isn't the right category for it. I thought I had
tracker admin rights? But if I go to Admin > Tracker to add a feature
request category, it tells me permission denied. Huh? Can a project
admin look into this?

hjh

-- 
James Harkins /// dewdrop world
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