[m-users.] file_exists? directory_exists?

emacstheviking objitsu at gmail.com
Sun Jun 30 03:02:23 AEST 2019


Firstly, thanks for writing The Craft of Prolog. It sits next to all the
others I have and I hope one day be smart enough to truly grok!
Secondly, you are right...we are all doomed and thinking about it does
indeed make you mad!

I was aware that see/seen was about reading the file, but I considered it
only polite to close it after opening it.  :)

Right now, I am *making myself* work through the PDF getting started book
by Ralph Becket and not diverging if i can possibly help it. The thing I
like about Mercury the most is that having spent too many hours scratching
my head in SWI debugger wondering why a predicate silently fails, is that
it throws back some of the burden of responsibility to the developer to
know ahead of time exactly what this predicate is supposed to be doing, I
mean, after all, *we* write them so we ought to know, even if it is
non-deterministic!

The modes and inst-ness are giving me some headaches but I am sure it will
all make sense eventually......it's harder for me at least because I didn't
go to university so I don't have a maths or Cs degree i.e. everything that
I've learned over the last 34 years has been self taught and I continue to
learn daily as I am a learning junkie. Sometimes I almost think it was a
good thing I didn't attend as I would never have left....

All the best,
Sean.



On Sat, 29 Jun 2019 at 15:42, Richard O'Keefe <raoknz at gmail.com> wrote:

> Using see + seen does not test whether a file *exists* but whether
> a file exists *and you are allowed to read it*.
>
> It has always been the case in Unix that the only way to determine
> if a file exists and you are allowed to read it is to try to open it
> for input, thanks to the existence of concurrent processes.
>
> With NFS, you can successfully open a file for input and
> then be told "you can't do that" when you try to read it.
>
> And then there's the possibility that a file might exist
> and you might be allowed to read it, but the name you
> have for it goes through a directory you aren't allowed
> to search.
>
> It you think too deeply about all the things that can go
> wrong with testing whether a file "exists" you will go
> mad. MAD, I say!  We're all DOOMED!
>
>
> On Sat, 29 Jun 2019 at 19:03, emacstheviking <objitsu at gmail.com> wrote:
>
>> Hi,
>>
>> All I have found is see/seen to see if a file exists. Have I missed
>> something totally obvious ?
>> And how about checking the existence of a directory too?
>>
>> It feels bad to have to use "see" and then "seen" (to undo see) just to
>> test a file exists.
>>
>> I am sure I have not found the docs but TBH they doc are just the code
>> for the module and when you are learning this stuff it makes it pretty hard
>> to find anything at times.
>>
>> Thanks,
>> Sean.
>>
>> _______________________________________________
>> users mailing list
>> users at lists.mercurylang.org
>> https://lists.mercurylang.org/listinfo/users
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurylang.org/archives/users/attachments/20190629/a868dc93/attachment.html>


More information about the users mailing list