[REBOL] Re: More dialects than you think, validating function input.
From: brett:codeconscious at: 13-Sep-2002 22:13
Hi Gregg,
> A very good post, and related to the discussion on error handling to boot!
Thanks!
> In a large system, and as more things are driven by dialects, this could
> prove very useful indeed.
It is probably overkill for some situations, on the other hand you never
know when you might want that one-off to be included in some large
undertaking. :^)
> In a large system, and as more things are driven by dialects, this could
> prove very useful indeed. Now, does anyone have a model they use to return
> helpful context information when a parse operation fails? Programmers are
OK
> with "Syntax error: expected integer!" but users are probably better
served
> by "I understood the first part ("sell 400 shares of MSFT at"), but then I
> was expecting to see a monetary value for the sell price (e.g. $50.00),
and
> I didn't, so I couldn't process your request. I'm sorry for any
> inconvenience this might cause you. Have a nice day." Or maybe just "No
sell
> price was specified in your request." or even a prompt for the missing
info.
I think you've got at least three issues there. One is relating to speaking
the user's language.
The second is determing exactly where in the input the error is - which is
more difficult.
Third is showing what is expected next.
Your "I understood the first part ..." is a good solution for showing the
user where processing got to.
As for the expecting bit. I don't think there is a general solution. Having
to tell the user "error...expecting money" adds an application requirement
making a bigger application. Each "expecting X" becomes an alternative rule
to the rule that is attempting a match. So your rules bloat out quite a bit
if you want to report on every grammar term. For some apps maybe it is
enough to say "Recognised two stock orders. Could not recognise the rest of
the instructions."
Regards,
Brett.