Code should be ready to o code. So the user can just copy and paste it into whatever project he is doing.
And who put you in charge of this type of thing? Besides, your example wouldn't work with your special rules either. They can't paste VBScript code into a batch file and have it work. Monotype is used either to indicate source code or output.
Anyway, the reason that there is no "FancyEval" is because it would be redundant. It wouldn't even make sense. What would it's preconditions be? What would this return with your fictitious "fancyEval" function:
WScript.Echo FancyEval("Left$(""test"",2)"),2)
How do you "round" a string? does the function not allow for expressions containing strings? What about intermediate expressions dealing with strings? Is it only the result that must be a number? From the sounds of things all your fancy eval is is a cheap wrapper around FormatNumber. Which again, is redundant. If the person calling eval wants to round values, they can use the built-in functions for it.
Some information on Eval's implementation; It's based on JScript's Eval() Function and discusses why VBScript has three (Execute(), ExecuteGlobal(), and Eval()). It's also important to note how there is no restriction, arbitrary or otherwise, on the return value of Eval(). Adding a parameter like "NumDigitsAfterDecimal" to Eval (or a variant thereof) would have the aforementioned issue that "DigitsAfterDecimal" Doesn't make sense for Strings, Objects, or Anything that isn't a number. How would you round a FileSystemObject to 2 decimal places? Is the parameter optional? What happens if you don't pass it? Can it ever return anything that isn't a number? What happens if it deals in strings/objects/etc? The parameter
wouldn't make sense, and this nor would the function. In what way does the added parameter make the Evaluation "Fancy", anyway?
If this is of interest, click on the ink above.
The only point I want to make is that round() is not the way to format When doing financial things, the correct format is very important
As long as they aren't storing the results from the round and are instead just using it for output, it doesn't matter. That's more an "exercise for the reader". How does it feel the echo exactly what I already said in regards to the Currency Variant Subtype, by the way? VBScript is NOT VB.NET and it's NOT VB6. If you are going to link docs- link to docs for VBScript.