The skip multisub in Rakudo's Test.pm is defined like this:

  multi sub skip()              is export() { proclaim(1, "# SKIP"); }
  multi sub skip($desc)         is export() { proclaim(1, "# SKIP " ~ $desc); }
  multi sub skip($count, $desc) is export() {
      for 1..$count {
          proclaim(1, "# SKIP " ~ $desc);
      }
  }

The first is reasonable, but the second and third awkward.  We have positional 
parameters whose position changes based upon the number of arguments.  We could 
do something like this:

  multisub skip();
  multisub skip(Int $count);

  multisub skip(Str $desc);
  multisub skip(Int $count, Str $desc);

However, that's going to break if $count is a string, right?

I am thinking that the Perl 5 way is 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?

Cheers,
Ovid
--
Buy the book         - http://www.oreilly.com/catalog/perlhks/
Tech blog            - http://use.perl.org/~Ovid/journal/
Twitter              - http://twitter.com/OvidPerl
Official Perl 6 Wiki - http://www.perlfoundation.org/perl6

Reply via email to