Re: -f ???

2017-09-29 Thread Brandon Allbery
On Fri, Sep 29, 2017 at 9:53 AM, Parrot Raiser <1parr...@gmail.com> wrote: > Discussing the full implications of these tests could probably keep a > philosophy class busy for an afternnon. It might even rise to an > LPU[1] paper. > It's even more involved than you think; I have notes for what

Re: -f ???

2017-09-29 Thread Parrot Raiser
>> In other words, I think we should change the Perl 6 spec to define .f as >> "exists and is a file". >> >> -- >> Mark Montague Mark and I appear to be having a vigorous agreement about the principle of Least Surprise. If -f X is defined as meaning &

Re: -f ???

2017-09-29 Thread Fernando Santagata
One might argue that -f returning Failure is like a SQL query returning NULL, which is appealing to me. On Fri, Sep 29, 2017 at 4:05 PM, Mark Montague <m...@catseye.org> wrote: > On 2017-09-29 09:53, Parrot Raiser wrote: > >> -e is fairly easy. It asks if something exists. Ig

Re: -f ???

2017-09-29 Thread Mark Montague
On 2017-09-29 09:53, Parrot Raiser wrote: -e is fairly easy. It asks if something exists. Ignoring Schrodinger, either it does (i.e True) or it doesn't. (False) -f is more ambiguous. It asks if something has a property (fileness) or not. If it exists, it either does or doesn't. [...] Bash

Re: -f ???

2017-09-29 Thread Parrot Raiser
Discussing the full implications of these tests could probably keep a philosophy class busy for an afternnon. It might even rise to an LPU[1] paper. -e is fairly easy. It asks if something exists. Ignoring Schrodinger, either it does (i.e True) or it doesn't. (False) -f is more ambiguous. It asks

Re: -f ???

2017-09-29 Thread Timo Paulssen
;; any Failure makes it through a return typecheck as if it were the right type, that's why you can "fail" in a method that has its return type set to be "Int", even though Failure doesn't derive from Int. So we don't have to go around giving every single method a return

Re: -f ???

2017-09-29 Thread Simon Proctor
So $f = so "eraseme.txt".IO.f; Would do the trick? On Fri, 29 Sep 2017, 6:56 am Norman Gaywood, <ngayw...@une.edu.au> wrote: > On 29 September 2017 at 15:10, Brandon Allbery <allber...@gmail.com> > wrote: > >> >> (And, Norman? It produces a Failure,

Re: -f ???

2017-09-28 Thread Norman Gaywood
her way of looking at it: $ perl6 -e 'my $f = "eraseme.txt".IO.f;say $f.WHAT' (Failure) and you can coerce that to a bool without throwing as other examples in the thread have shown. perl6 -e 'my $f = "eraseme.txt".IO.f; say $f.WHAT; say ?$f' (Failure) False Or plain old ver

Re: -f ???

2017-09-28 Thread ToddAndMargo
line told me that there is an error in the     docs.  The proper way was "e" not "f" This is not the same thing. .e will return True if it exists but is a directory, for example. I mentioned this in my first response. In fact, the different behavior seems inconsistent and migh

Re: -f ???

2017-09-28 Thread ToddAndMargo
  The proper way was "e" not "f" This is not the same thing. .e will return True if it exists but is a directory, for example. I mentioned this in my first response. In fact, the different behavior seems inconsistent and might be a bug. Yup.  That is what the docs say. 

Re: -f ???

2017-09-28 Thread Brandon Allbery
On Fri, Sep 29, 2017 at 1:10 AM, Brandon Allbery wrote: > Apparently not a bug, just unfortunate. You have to explicitly coerce it > to Bool to keep it from throwing. > > pyanfar Z$ 6 '".profileX".IO.f.Bool.say' > False > This can also be done with 'so' or prefix

Re: -f ???

2017-09-28 Thread ToddAndMargo
On 09/28/2017 10:12 PM, Brandon Allbery wrote: On Fri, Sep 29, 2017 at 1:09 AM, ToddAndMargo <toddandma...@zoho.com <mailto:toddandma...@zoho.com>> wrote: Figured it out.  The chat line told me that there is an error in the docs.  The proper way was "e" not &quo

Re: -f ???

2017-09-28 Thread Brandon Allbery
On Fri, Sep 29, 2017 at 1:09 AM, ToddAndMargo <toddandma...@zoho.com> wrote: > Figured it out. The chat line told me that there is an error in the > docs. The proper way was "e" not "f" > This is not the same thing. .e will return True if it exists but is a

Re: -f ???

2017-09-28 Thread Brandon Allbery
On Fri, Sep 29, 2017 at 1:06 AM, Brandon Allbery <allber...@gmail.com> wrote: > On Fri, Sep 29, 2017 at 12:59 AM, ToddAndMargo <toddandma...@zoho.com> > wrote: > >> On 09/28/2017 09:53 PM, ToddAndMargo wrote: >> >>> On 09/28/2017 09:45 PM, Brandon Al

Re: -f ???

2017-09-28 Thread Brandon Allbery
On Fri, Sep 29, 2017 at 12:59 AM, ToddAndMargo <toddandma...@zoho.com> wrote: > On 09/28/2017 09:53 PM, ToddAndMargo wrote: > >> On 09/28/2017 09:45 PM, Brandon Allbery wrote: >> >>> IO::Path's .f method. (Or .e to not require it to be a file, etc. as >

Re: -f ???

2017-09-28 Thread Norman Gaywood
I was just reading about this! On 29 September 2017 at 14:53, ToddAndMargo <toddandma...@zoho.com> wrote: > > $ perl6 -e 'say "erasxeme.txt".IO.f;' > Failed to find '/home/linuxutil/erasxeme.txt' while trying to do '.f' > in block at -e line 1 > Whe

Re: -f ???

2017-09-28 Thread ToddAndMargo
On 09/28/2017 09:53 PM, ToddAndMargo wrote: On 09/28/2017 09:45 PM, Brandon Allbery wrote: On Fri, Sep 29, 2017 at 12:41 AM, ToddAndMargo <toddandma...@zoho.com <mailto:toddandma...@zoho.com>> wrote:     Does perl 6 have an equivalent to bash's "-f" to   

Re: -f ???

2017-09-28 Thread ToddAndMargo
On 09/28/2017 09:45 PM, Brandon Allbery wrote: On Fri, Sep 29, 2017 at 12:41 AM, ToddAndMargo <toddandma...@zoho.com <mailto:toddandma...@zoho.com>> wrote: Does perl 6 have an equivalent to bash's "-f" to see if a file exists?  Or is that a system call? IO::Pa

Re: -f ???

2017-09-28 Thread Brandon Allbery
On Fri, Sep 29, 2017 at 12:41 AM, ToddAndMargo <toddandma...@zoho.com> wrote: > Does perl 6 have an equivalent to bash's "-f" to > see if a file exists? Or is that a system call? > IO::Path's .f method. (Or .e to not require it to be a file, etc. as usual.)

-f ???

2017-09-28 Thread ToddAndMargo
Hi All, Does perl 6 have an equivalent to bash's "-f" to see if a file exists? Or is that a system call? Many thanks, -T