on 3/23/07 10:56 PM, Guyren Howe at [EMAIL PROTECTED] wrote: > On Mar 23, 2007, at 9:38 PM, Chris Little wrote: > >> The problem with this is that you can't tell what each return value >> is. To >> use an example from another of your replies: >> >> Function ParseDate(stringDate as string) as integer, integer, integer >> >> How do you tell the order of the return values? The function >> signature loses >> all self documenting ability. You would at least have to have some >> kind of >> naming of return values. > > This is no more nor less confusing than having to remember what the > order of the arguments is when calling a method.
Excepting that RB will tell you the function signature and the names of the parameters when you are calling the function. When all you have for the return values is multiple types you would actually have to go look at the source to decide what was returned in what value. >>> If the number of lvalues differs from the number of return values, >>> then: >>> >>> - if there are more lvalues, the excess values are Nil/0/""/etc >>> - if there are excess return values, the excess are ignored. >>> >>> Notice that these semantics lets the function return values in the >>> order that is most useful. CountWords then doubles as a handy "unique >>> words" function: >> >> I don't like this at all. It could lead to fragile code once when >> you start >> having to account for type conversions. > > Please explain. As long as the first return values is an array RB is only going to let you assign it or pass it to another method/function with the same type. If the return values are something else though it will let assignment/passing take place through conversion. If I had to change one of these multi-return functions I probably have to manually search each call out instead of letting the compiler do the work for me. I like RB being strongly typed. If the function returns multiple values then you should have to do something with each one. Chris _______________________________________________ Unsubscribe or switch delivery mode: <http://www.realsoftware.com/support/listmanager/> Search the archives: <http://support.realsoftware.com/listarchives/lists.html>
