Em Qui, 2009-07-09 às 22:50 -0400, Buddha Buck escreveu:
> Both the separate pathname type and the stat($str, :e) proposal
> salvage the purity of Str, so either would be acceptable to your
> argument.

The bigger problem of using a different type is that 

 "/etc/passwd" ~~ :e

Would dispatch to Str, which means that you'd need to

 PathName("/etc/passwd") ~~ :e

which doesn't seem much interesting huffman-wise.

On the other hand, a multi would allow more clear semantics, and
wouldn't require an explicit typecast, as in:

 stat "/etc/passwd", :e

This still allow the existance of the most specific PathName type, and a
signature like

 multi stat(PathName $name, *%switches) { ... }


 role PathName {
   multi method ACCEPTS(Str $path where { .defined }) {
     $path ~~ /<PathName::token>/
   multi method ACCEPTS(Str $path where { not .defined }) {


Reply via email to