in reply to Your named arguments
Please provide an example of how you would handle this contrived and simple case, as a teaser presented in Perl 6:
Most of the time I would do something like:
sub convert { my ( $from, $to, $thing ) = @{ {@_} }{ qw( from to thing ) }; ... }
With in-house code I find that my test suite reveals where I accidentally miss required parameters, so I only add explicit code inside the subroutine to check if it's an API I'm presenting to others.
|
|---|