old-design-docs
old-design-docs copied to clipboard
IO::Path clarifications
Working on borrowing IO::Path for Niecza, I've come up with a few questions.
-
Say we've got
my $p = IO::Path.new(:basename("4th.pl"), :directory("."), :volume(""))
What should $p
be? The spec says "Stringification returns the path (volume, directory and base name joined together) as a string", which to me would naively suggest ./4th.pl
. But Rakudo and Roast seem to think it should be just 4th.pl
. That's reasonable, I'm just curious what the official rules for this should be.
-
S32-io/dir.t has a test which does
my @files = dir(); @files.grep('t');
Should that's trying to smartmatch an IO::Path and a Str. Should that work?
I will add more things here as they come up...
Talking with labster++ I've concluded that smartmatching IO::Path ~~ Str
should indeed work, as Str.ACCEPTS
does an eq
check, which should convert IO::Path to Str.