unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: Joshua Branson via "Bug reports for GUILE, GNU's Ubiquitous Extension Language" <bug-guile@gnu.org>
To: Jean Abou Samra <jean@abou-samra.fr>
Cc: 59221@debbugs.gnu.org, tomas@tuxteam.de
Subject: bug#59221: (file-exists? #f) raises an exception
Date: Wed, 16 Nov 2022 10:27:34 -0500	[thread overview]
Message-ID: <87bkp62a3d.fsf@dismail.de> (raw)
In-Reply-To: <1b3d4aa0-139c-1491-cd08-57055b9bec7a@abou-samra.fr> (Jean Abou Samra's message of "Sun, 13 Nov 2022 11:34:08 +0100")

Jean Abou Samra <jean@abou-samra.fr> writes:

> Le 13/11/2022 à 07:44, tomas@tuxteam.de a écrit :
>> You both have a point. Checking for existing predicates with a
>> longer tradition, though:
>>
>>    scheme@(guile-user)> (exact? "mumble")
>>    ice-9/boot-9.scm:1685:16: In procedure raise-exception:
>>    In procedure exact?: Wrong type argument in position 1: "mumble"
>>
>> seems to support Jean Abu's position that it is more customary to
>> raise for an argument of the wrong type. Also `string<?', etc.
>> do this. That seems to be the consensus.
>
>
> Yes. I am not sure where the people in the Guile IRC got the idea
> that a predicate shouldn't raise an exception. Lots of predicates in
> Guile do, and that is very helpful because it catches mistakes.
>
>
>> Naively, it just feel like it (file-exists? #f) should return #f.
>
>
> Why?
>

hmmm, somehow I missed your response.  I guess for my simple use case,
it just made more sense.  I am defining a service for guix that asks for
user input.  If the user doesn't type in input, the default value was
#f.

That's fine.  Thanks for all's replies.  I'll go ahead and close this
bug!

Thanks!

>
>
>> Would there be an objection to changing the definition of file-exists to
>>
>> (define (file-exists file)
>>      (and (string? file)
>>           (old-file-exists-code file)))
>
>
>
> It would be inconsistent with the rest of Guile and I don't
> see what it would help with.
>
> Best,
> Jean





      reply	other threads:[~2022-11-16 15:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-12 17:49 bug#59221: (file-exists? #f) raises an exception Joshua Branson via Bug reports for GUILE, GNU's Ubiquitous Extension Language
2022-11-12 17:57 ` Jean Abou Samra
2022-11-13  2:15 ` jbranso--- via Bug reports for GUILE, GNU's Ubiquitous Extension Language
2022-11-13  6:44   ` tomas
2022-11-13 10:34     ` Jean Abou Samra
2022-11-16 15:27       ` Joshua Branson via Bug reports for GUILE, GNU's Ubiquitous Extension Language [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bkp62a3d.fsf@dismail.de \
    --to=bug-guile@gnu.org \
    --cc=59221@debbugs.gnu.org \
    --cc=jbranso@dismail.de \
    --cc=jean@abou-samra.fr \
    --cc=tomas@tuxteam.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).