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

[Sc-devel] Re: [sc-users] error when using .gui method on an Instr



Moving to sc-devel:

How about this for an informal specification?

Case 1: user runs code in a window that has a path. No error. While running, "now executing path" holds the document path and it's cleared on return.

Case 2: same thing except there is an (unhandled) error. For the sake of error output, I'd rather not use protect -- but in this case the exit path is through Object:halt. Since that is always going to stop execution, I think it's fair to clear the now executing path in this method as well.

Case 3: execute file with no error. Handled correctly with the "protect" change I posted the other day.

Case 4: execute file with error. I think it's okay if the error output is compromised here, because you can always run the file interactively to find out where the error is.

This does not cover asynchronous activities -- that would be a real hornets' nest.

In other words:

+ Interpreter {
executeFile { arg pathName ... args;
var result, saveExecutingPath = thisProcess.nowExecutingPath;
if (File.exists(pathName).not) { ["file \"",pathName,"\" does not exist."].join.postln; ^nil };
thisProcess.nowExecutingPath = pathName;
protect { result = this.compileFile(pathName).valueArray(args) }
{ thisProcess.nowExecutingPath = saveExecutingPath };
^result
}

interpretPrintCmdLine {
var res, func, code = cmdLine;
"\n".post;
preProcessor !? { cmdLine = preProcessor.value(cmdLine, this) };
func = this.compile(cmdLine);
thisProcess.nowExecutingPath = Document.current.path;
res = func.value;
thisProcess.nowExecutingPath = nil;
codeDump.value(code, res, func, this);
res.postln;
}
}

+ Object {
halt {
thisProcess.nowExecutingPath = nil;
UI.reset;
this.prHalt 
}
}

Scott, do you see any problems with this?
hjh


On Dec 21, 2007, at 1:47 PM, James Harkins wrote:

On Dec 21, 2007, at 1:13 PM, felix wrote:

thisProcess.interpretCmdLine could set nowExecutingPath with Document.current.path
and unset it if there is a fatal error.

... and the error printout becomes useless for troubleshooting. I'm not sure we want to make that a general situation.


: 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