in reply to Re^4: How should named paramater keys be named?
in thread How should named paramater keys be named?
where you specify the callbacks by name instead of by position, as usually, you want only to set one or two callbacks.
Optional arguments are the exception that proves the rule. (IMO :)
The DateTime API wants me to always specify named parameters when I'm calling any function even though the method only allows one parameter and makes sense for only one parameter.
And that demonstrates the problem with guidelines. There will always be those who apply them religiously without thinking. Cargo-culting of the very worst kind.
Another that bugs me is q().
The Imager::Color API raises no warning for: ... but creates no sensible object either.
I liked the SmallTalk approach to the problem where the names of arguments to methods are effectively a part of the method identifier. Eg.
pen: anInteger for: aHandle medium: aGraphicsMedium
The best bit about this is that the parameter names are checked at compile time.
|
|---|