I personally prefer keyed lists. This allows you to add or remove arguments to the proc without affecting the fucntionality or compatibility if the proc is being used in multiple places .. like so ..
#
# Populate the arguments to send to the proc SendEmailMessage
# and call the proc.
#
keylset mailargs MH $mh
keylset mailargs TOFILE $blnTrcWrite
keylset mailargs HOSP $msghosp
keylset mailargs MAILTO $mailto
keylset mailargs MAILFROM $mailfrom
keylset mailargs MAILSUBJ $mailsubj
keylset mailargs MAILMSG $mailmsg
keylset mailargs MAILSERVER $mailserver
keylset mailargs MAILDOMAIN $maildomain
keylset mailargs MAILSTART $mailstart
keylset mailargs MAILSTOP $mailstop
SendEmailMessage $mailargs
… and in the called proc get the data out of the argument keyed list …
proc SendEmailMessage { mailargs } {
keylget mailargs MH mh
keylget mailargs TOFILE blnTrcWrite
keylget mailargs HOSP hosp
keylget mailargs MAILTO mailto
keylget mailargs MAILFROM mailfrom
keylget mailargs MAILSUBJ mailsubj
keylget mailargs MAILMSG mailmsg
keylget mailargs MAILSERVER mailserver
keylget mailargs MAILDOMAIN maildomain
keylget mailargs MAILSTART mailstart
keylget mailargs MAILSTOP mailstop
As I mentioned this gives you alot of flexibility to add or remove arguments and functionality to a proc while keeping it backwards compatible with other places its being used.
Also, it doesn’t matter what order you supply the arguments because the list is keyed. So, you don’t have to remember that the first argument is X and the second is Y the third is Z and take a chance of putting them in the wrong order when calling the proc.
Hope this helps