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

[Sc-devel] StartUp:run should protect itself?



Hi -

I'm just getting some of my SC stuff up and running on a new machine,
and I notice that if one of the functions added to StartUp bombs out
with some error (e.g. a ugen I forgot to install, stopping synthdef
compilation), that prevents other startup functions from running.
There's no protection against errors:

	*run {
		done = true;
		functions.do(_.value);
		"StartUp done.".postln;
	}

Wouldn't it be better to insulate each separate function from the
others by wrapping it in a try{}?

	*run {
		done = true;
		functions.do({ |func|
			func.try{|error|
				"StartUp: an error has occurred.".postln;
				error.postln;
				"Thrown during function:".postln;
				func.postcs;
			}
		});
		"StartUp done.".postln;
	}

The functions added to StartUp should all be independent, since
they're typically coming from different classes/scripts. If you want
one startup thing to depend on another, you can (and should) code that
dependence in a single function to be added to StartUp.

This sound sensible?

Dan