>Any muppet who calls it with a string deserves everything
>that's coming.
>Errors are not necessarily bad things - in the case of
>Type MisMatch, they can prevent people trying to do
>things that you'd rather they didn't.
You're right--errors aren't necessarily bad things. But if you can prevent users or other programmers from doing things you don't want them to do, well... that's even better, isn't it?
One thing I like rather a lot about having Variants in your arguments is that a routine can then deal with different kinds of arguments... rather like overloading, something you'll have met in C++ and Java, but which is completely lacking in VB (or is it available in .NET?)
Reading that he proposes variants for all arguments certainly made me shift uneasily. But, being willing to learn I thought I'd give it a try. Part of the reason for using variants is that you can never know what the calling routine will give you in the future (not at the moment of coding, usually). So giving the calling routine some freedom in calling without having to convert variables
and doing extensive conversion and validating on passed arguments in the routine seems like a good idea to me. It also forces you to thouroughly validate all arguments.
If your routine expects an integer and the calling routine gives it a string, well... it's not a problem if the string is numeric (when using variants). If it's not numeric, a Safe Error Message will take care of that. This does depend on well-coded conversion and validation routines, but once they're in place... It also does not stop execution (necessarily).
But hey, maybe in a few month's time I'm on my face wondering how on earth I could have typed 'As Variant' so often.
The Safe Error Message model seems to work well for now. I guess the real deal is when a team of programmers is working on a project over a few generarions (both of the application and the team). For the quick and dirty applications there's no real need. But somewhere in the back of my head Gill is saying: "There should be no such thing as a quick and dirty application.