in reply to Function overloading in perl
Remember that (in one of several “ways to do it”), the arguments to any function-call are simply ... a list. Therefore, it is indeed possible for the number of arguments and so-forth to vary from one call to the next.
It would be possible, albeit somewhat cumbersome, for a sub to examine its parameter-list and “do the right thing.”
As guidance, I would say: “whatever you decide to do, make whatever you decide to do abundantly clear.” Personally, I do not find “overloaded functions” to meet that qualification, so I don't use them. But, that's just me. Keep in mind both yourself and all those who will follow you... the latter of which, of course, cannot divine your intentions (as you may recal, you got smooshed by a bread-truck, poor sot...) and have only your code to go by.
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Function overloading in perl
by moritz (Cardinal) on Mar 30, 2009 at 13:16 UTC |