[stringtemplate-interest] which ST errors are serious
Terence Parr
parrt at cs.usfca.edu
Mon Nov 30 17:16:15 PST 2009
hiya. finished gui prototype. racing to finish ST v4 alpha as Jim Idle finishes v3-izing ANTLR v3. then I can hook it in to test.
One major thing left: what to do with "errors." E.g., what should happen when you ref a template that doesn't exist? Now in v4, i emit an error to a listener (which u can set) and use a blank ST. My goal will always be to proceed with a reasonable response, even upon error. another example: <a.b>. What if object 'a' does not have a 'b' property? It seems like I should just keep going and pretend that the value doesn't exist like I do when you reference <a> and 'a' doesn't exist.
But, what should I do with the error notification? Should I just always emit an error to the listener and let you ignore what you don't care about? Currently in v3, the problem is that I spew stack trace to stderr when I find a problem with <a.b> and so on. ugly.
I do have a prototype of something called ErrorTolerance that lets you indicate what errors you care about. If you want to play loose, ST won't tell you about any errors unless they are things like "can't write file". But, for language execution errors, you have a choice about what to hear about. Does that make sense? By default, I guess, you would want to hear about unknown templates and weird template names like "f x.e \".
ErrorTolerance.detect(
DETECT_UNKNOWN_TEMPLATE |
DETECT_MALFORMED_TEMPLATE_NAME
);
Does that make sense? now is the time to tell me about what you hate about current error handling :)
Ter
More information about the stringtemplate-interest
mailing list