in reply to named arguments
1. Where is the line, for you, between "need named arguments" and "don't need named arguments" ?
Well, for one thing I like to keep the calling convention for all methods or subroutines in a module consistent.
Sometimes it makes sense to follow the calling styles of similar modules, especially if the module is designed as an alternative.
That said, I prefer using named arguments but sometimes use both, if there's a small number of arguments but many optional "options" to pass to a routine:
$obj->method( $first, $last, \%options );
2. What is your favorite way of doing it ? I like to name arguments in Tk's style (-arg) - because I find CAPPED_NAMES bulky, and non_capped_names can clash with symbols. I also use the ending @_ trick to provide default values inside the sub.
I really dislike the Tk calling style with the beginning hyphen. CAPPED_NAMES are irritating, and I prefer to use them for constants and names of constant hash keys in objects. I don't find there to be a problem with non_capped_names clashing with symbols: if there's a clash, consider using different names.
|
|---|