On Sun, Nov 25, 2018 at 5:34 PM Brad Gilbert <b2gi...@gmail.com> wrote:

> The reason `dir('a', test => { .IO.d })` doesn't work like you expect
> is that it is passed strings.
>

Thank you!
I could have inferred that from the declaration of the 'test' argument here
https://docs.perl6.org/routine/dir where the test is being done against '.'
and '..', two strings:

sub    dir(Cool $path = '.', Mu :$test = none('.', '..'))
> method dir(IO::Path:D: Mu :$test = none('.', '..'))
>

but I guess it's a long stretch.
Maybe a note in the docs would be useful to others.


> I would argue that inside of the `test` that `$*CWD` should be set to
> `a`, and/or the values should be IO objects.
> (They are going to become IO objects eventually anyway.)
>

Indeed I think that even tough one can do any kind of test on the
directory's content, the most usual ones are those using the file test
operators, so defaulting to IO is probably more useful than defaulting to
Str.
-- 
Fernando Santagata

Reply via email to