Passing the same named parameter multiple times should be an error.
As with hash initialization, you can specify the same key
multiple times and the last occurrence wins:
rectangle(height => 1, width => 2, height => 2, height => 5);
# same as: rectangle(width => 2, height => 5);
I don't see why this should be a documented feature. IMO it's going to be a mistake far more often than it's intended. The only time I can think this is a good idea is to override the defaults. Method::Signatures explicitly disallows it.
The same feature can be implemented by putting the options into a hash first. This has the advantage of being explicit. It's going to be pretty rare, so the extra code is ok.
my %defaults = (height => 1, width => 2);
my %args = (%defaults, %your_args);
rectangle(%args);
The Perl idea that parameters are just a list (or list being flattened into a hash) is a weird language quirk. Function parameters should not hold over those quirks.
The first version of this feature actually did that. I scrapped it after performance testing: No matter what I did, I couldn't get it to run as fast as shoving everything into a hash first.
What kind of performance difference are we talking?