[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#59221: (file-exists? #f) raises an exception

From: Jean Abou Samra
Subject: bug#59221: (file-exists? #f) raises an exception
Date: Sun, 13 Nov 2022 11:34:08 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.1

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.


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.


Attachment: OpenPGP_signature
Description: OpenPGP digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]