3245 - refuse to run programs with errors
I started out incredibly lax about running past errors (I even used to call them 'warnings' when I started Mu), but I've been gradually seeing the wisdom of Go and Racket in refusing to run code if it doesn't pass basic integrity checks (such as using a literal as an address). Go is right to have no warnings, only errors. But where Go goes wrong is in even caring about unused variables. Racket and other languages perform more aggressive integrity checks so that the can optimize more aggressively, and I'm starting to realize I don't know enough to disagree with them.
This commit is contained in:
parent
2d7131670e
commit
43781c7b69
|
@ -152,12 +152,13 @@ struct trace_stream {
|
|||
|
||||
|
||||
trace_stream* Trace_stream = NULL;
|
||||
int Trace_errors = 0; // used only when Trace_stream is NULL
|
||||
|
||||
// Top-level helper. IMPORTANT: can't nest
|
||||
#define trace(...) !Trace_stream ? cerr /*print nothing*/ : Trace_stream->stream(__VA_ARGS__)
|
||||
|
||||
// Errors are a special layer.
|
||||
#define raise (!Trace_stream ? (tb_shutdown(),cerr) /*do print*/ : Trace_stream->stream(Error_depth, "error"))
|
||||
#define raise (!Trace_stream ? (tb_shutdown(),++Trace_errors,cerr) /*do print*/ : Trace_stream->stream(Error_depth, "error"))
|
||||
// Inside tests, fail any tests that displayed (unexpected) errors.
|
||||
// Expected errors in tests should always be hidden and silently checked for.
|
||||
:(before "End Test Teardown")
|
||||
|
|
Loading…
Reference in New Issue