unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Dirk Herrmann <dirk@dirk-herrmanns-seiten.de>
Cc: bkorb@veritas.com, guile-devel@gnu.org
Subject: Re: GH replacement proposal (includes a bit of Unicode)
Date: Thu, 22 Apr 2004 19:36:09 +0200	[thread overview]
Message-ID: <40880289.8070405@dirk-herrmanns-seiten.de> (raw)
In-Reply-To: <87vfjtm2v5.fsf@zagadka.ping.de>

Marius Vollmer wrote:

>Sooo, right now I'm wembleying towards having
>
> scm_is_true   --- return 0 for #f, 1 for everything else
> scm_is_false  --- return 1 for #f, 0 for everything else
>
> scm_is_bool   --- return 1 for #t and #f, 0 for everything else
> scm_to_bool   --- return 0 for #f, 1 for everything else
> scm_from_bool --- return #f for 0, #t for everything else
>
The names scm_is_true and scm_is_false don't fit into the schema, since 
true and false are no types. I am not sure if this is intentional or 
just an oversight. Further, if implemented as above, scm_is_true does 
not bring additional benefit and is confusing, since scm_is_false checks 
for #f, while scm_is_true checks for not-#f. But, there is still not yet 
any function that checks for #t. To do so, you would first have to call 
scm_is_bool and scm_is_true afterwards.

>Is there an advantage of having instead
>
> scm_to_bool   --- return 0 for #f, 1 for #t, else signal error
>  
>
This is certainly the most symmetric approach. If this approach was 
used, then (some maybe different named equivalent of) scm_is_true and 
scm_is_false (checking for exactly #t and #f) would begin to make sense, 
since scm_is_true would then be useful to replace the 
scm_is_bool/scm_to_bool sequence, similar with scm_is_false. However, I 
can well live with scm_to_bool giving 1 for anything but #f, since even 
in scheme the interpretation of non-#f values as true values is 
standard, and the explicit comparison with #t is comparably seldom.

>What about
>
> scm_from_bool --- return #f for 0, #t for 1, else signal error
>
I would accept any value != 0 as false here. Even when the new ISO-C99 
_Bool type was used, this would still work, since integers will 
implicitly be converted to _Bool, giving 0 for 0, 1 for any non-zero 
value. That is, if we plan to change the argument type to _Bool later, 
signalling an error for values != 0 and != 1 would then become useless 
anyway.

Best regards
Dirk



_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel


  parent reply	other threads:[~2004-04-22 17:36 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-07 13:00 GH replacement proposal (includes a bit of Unicode) Marius Vollmer
2004-04-07 15:04 ` Paul Jarc
2004-04-13 13:25   ` Marius Vollmer
2004-04-13 15:54     ` Paul Jarc
2004-04-21 15:08       ` Marius Vollmer
2004-04-21 16:10         ` Paul Jarc
2004-04-21 18:06           ` Marius Vollmer
2004-04-21 16:31         ` Delivery failure (guile-devel@gnu.org) Bruce Korb
2004-04-21 21:34           ` GH replacement proposal (includes a bit of Unicode) Marius Vollmer
2004-04-21 21:46             ` Paul Jarc
2004-04-21 22:19               ` Dale P. Smith
2004-04-21 22:34                 ` Paul Jarc
2004-04-21 23:02                 ` Kevin Ryde
2004-04-22 17:36             ` Dirk Herrmann [this message]
2004-04-22 18:31               ` Paul Jarc
2004-05-17 21:14                 ` Marius Vollmer
2004-05-17 21:57                   ` Bruce Korb
2004-05-18  9:54                     ` Marius Vollmer
2004-04-22 17:00         ` Dirk Herrmann
2004-04-24 10:06         ` Dirk Herrmann
2004-04-24 19:46           ` Marius Vollmer
2004-04-25 20:33             ` Dirk Herrmann
2004-04-25 21:38             ` Paul Jarc
2004-05-17 21:45               ` Marius Vollmer
2004-04-17 13:21 ` Dirk Herrmann
2004-04-22  4:16   ` Rob Browning
2004-04-22 17:48     ` Dirk Herrmann
2004-05-12 20:09   ` Marius Vollmer
2004-05-15  9:50     ` Dirk Herrmann
2004-05-24 18:51       ` Marius Vollmer
2004-05-25  0:21         ` Paul Jarc
2004-05-26 21:27         ` Dirk Herrmann
2004-06-03 21:40           ` Marius Vollmer
2004-06-04  6:52             ` tomas
2004-08-09 22:29               ` Marius Vollmer
2004-05-15 10:18     ` Dirk Herrmann
2004-05-24 19:36       ` Marius Vollmer
2004-05-26 22:11         ` Dirk Herrmann
2004-08-09 22:28           ` Marius Vollmer
2004-04-22  4:39 ` Rob Browning
2004-04-22 17:58   ` Dirk Herrmann
2004-04-23  0:25     ` Rob Browning
2004-04-23 16:57   ` Marius Vollmer
2004-04-23 17:16     ` Rob Browning
2004-05-17 21:24       ` Marius Vollmer
2004-04-23 17:36     ` Andreas Rottmann
2004-05-17 21:30       ` Marius Vollmer
2004-05-18  9:21         ` Andreas Rottmann
2004-04-25  7:54     ` Dirk Herrmann
2004-05-17 21:44       ` Marius Vollmer

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=40880289.8070405@dirk-herrmanns-seiten.de \
    --to=dirk@dirk-herrmanns-seiten.de \
    --cc=bkorb@veritas.com \
    --cc=guile-devel@gnu.org \
    /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).