Update 28.11.07: Tim Tripcony wrote a somewhat related article about using ByVal for input parameters. Recommended read!
Upon reading "Code Complete", I discovered that a way of using Subs I've previously thought of as bad practice, actually is quite normal.
The author writes (I apologize if I interpreted this wrong) that some developers think that functions should be used for mathematical calculations/simple operations and procedures used for more advanced stuff. In LotusScript, from his description, a Sub is a procedure and a Function is a function (duh..).
He also suggest that when you make procedures, you put input parameters (read) first , and output-parameters (modify) second, to make it easier to read the code.
One of the advantages with using subs this way is that you can always maintain strong typing. This enables you to capture coding-errors at compile-time, instead of at runtime.
In the code below:
createToyotas is a sub that has an outputparameter, List As Toyota
toyotas is a function that returns a variant containing List As Toyota
The compiler recognizes that a "Toyota" doesn't have a method "destroyWorld", whereas the variant, also a Toyota, passes through compiling.
Error caught at compile-time with strong typing, whereas the variant doesn't cause an error until runtime.
In most cases you could probably pinpoint the runtime-error quite fast, but catching it at compile-time is preferrable for me at least.
Also, the most common error would probably be a spelling-mistake, not trying to run a random thought-up method.
Performance-wise, there may also be advantages, especially if you're using inheritance/creating many objects/etc.
When debugging there doesn't seem to be much advantage using strong typing over variants.
>> Extremely simple db with some (messy)test-code (test-agent, StrongTypingAdvantage)
If you can think of other advantages, or disadvantages for that matter, please post a comment!