You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently we have methods that preform some action with out input:
my$rounded_number = 12.1->round;
Others expect input:
my$joined_string = [1,2,3]->join(':');
Should a call to join with out any input be an exception:
my$joined_string = [1,2,3]->join;
If so, for the sake of consistency should we now make ->round an exception to? How will we inform the user what methods take input and which ones do not?
The text was updated successfully, but these errors were encountered:
Default to yes. Which is to say, if you're not sure what the default should be make it an exception. This is to counter act the Perl tendency to make everything do something. We can always make it not an exception later whereas the other way around has to wait for a major version.
Otherwise, I don't think we need to make a blanket rule about what handing a method no argument means. Its a case by case basis how obvious the default is. You can figure that out by having a little conversation with yourself.
Alice: Round 12.1 please.
Bob: 12
See how one doesn't have to ask "to what precision" or "up or down". Even though these are rounding options, humans, on a regular basis, round in one way.
Contrast with join...
Alice: Join "foo", "bar", and "baz" together.
Bob: Join them with what?
Alice: Commas.
Alice could have equally likely said "spaces" or "tabs" or "nothing". Good indicator that join should not have a default.
This is related to #241
Currently we have methods that preform some action with out input:
Others expect input:
Should a call to join with out any input be an exception:
If so, for the sake of consistency should we now make ->round an exception to? How will we inform the user what methods take input and which ones do not?
The text was updated successfully, but these errors were encountered: