--- On Thu, 7/9/09, Moritz Lenz <[email protected]> wrote:
> . . .
> Somehow the current file test syntax, 'filename' ~~ :e, looks like a not
> well-though-out translation of Perl 5's syntax, -e 'filename'.
> Apart from totally feeling wrong to me,
Dunno about totally. I'm still trying to get a P6 mindset, but there's a lot to
be said (evidenced by how much has been said) for having an "old-fashioned" and
more familiar way to do it.
I'm underinformed, so I won't waste everyone's time on internals I haven't
checked.
> 3) I haven't look too closely at the list of proposed Perl 6 file test
> operators, but Perl 5 has 29 of them. The idea of having 29 single
> letter methods in class Str doesn't make me all that happy.
This doesn't sound ideal, but I don't panic over it. Wrap them in the class and
you get some benefits. Personally, I don't mind losing some Huffmen
convenience, though; I've seldom used most of them, and even for the ones I use
most I don't mind having a more descriptive name that makes me hit a few extra
keys. I just want to be able to accomplish whatever it is that I need to do.
> So I collected other ideas, both in my brain and in #perl6.
> Some of them are:
>
> $str.f.exists # Str.f returns an "interpret this object
> $str.f.size # as a file name" object
>
> $str.File.e # same, different names
> $str.stat.exists # again
>
> stat($str, :e) # let multi dispatch handle it for us
I'd prefer $str.File.exists; I'm not crazy about $str.f.whatever.
===============================================================
Hodges' Rule of Thumb: Don't expect reasonable behavior from anything with a
thumb.