On Jan 21, 2009, at 10:47 AM, Ovid wrote:
However, that's going to break if $count is a string, right?
Thought this might work as a heuristic for that third definition:
# Won't get called unless the string has a non-digit in it
multisub skip( Str $desc where { $desc ~~ /\D/ } );
Thus, you could call this and it will still DWIM:
if $cond {
skip "3";
else {
# run three tests
}
Obviously, not having a description is bad, but so are
straightjackets.
It's not worse than plain `skip()`.
Also, I'm not comfortable with the heuristic nature of this.
What do you mean?
I am thinking that the Perl 5 way may be better here. We have
(effectively):
multisub skip(Str $desc);
multisub skip(Str $desc, Int $count);
Otherwise, we stick with named parameters, but that's a bit odd
since every other function exported uses positional parameters.
Thoughts?
Yeah: No named parameters, please. :-)
David