From: Mike N. <ta...@al...> - 2003-03-03 17:48:04
|
Alex Peshkov wrote: > This syntax with string-only substitution sounds good for me. > Must we enable exceptions like: > FOO='Hey {3}, you can't {1} record #{3}!' > Should we treat this as a bug or: > 'Hey Mike, you can't delete record #Mike!' The latter. Even if perhaps a bit odd to not use parameter 2 in this example, I don't see why reusing parameters like this would be a problem. > Should we require precise match for number of exception params > and {n} in exception or may replace missing one with empty strings > and ignore unneeded? I think parameters that are requested in format string but not present at the point of use (i.e. the exception clause) should be allowed, at least we shouldn't SEGV. :-) What such missing parameter should be replaced with, I do not know. An empty string is one possibility, but perhaps the string "{missing exception parameter n}", where 'n' would be the parameter number expected, such as "{3}". I'd also expect that string to be hard-coded and not subject to localisation. What could pose another problem, maybe even more interesting, would be to give too many parameters. What should the outcome of that be? I believe it should do substitution as requested, but maybe display even the error? Something like: Hey nn, ... (the real message) Too many parameters to exception FOO from SP BARF. Expected 3 but got 6 parameters. param4: "Symphony of destruction" param5: "3.1415926535897932384626433832795" param6: "80:4711" The "from SP BARF" might or might not be a good thing to have, to help in tracking down such offenders. But this is still all an academic discussion, right? :-) /Mike |