[Top][All Lists]

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

Re: Fixes boolean/SCM confusions, part 1. (issue 4875054)

From: Bertrand Bordage
Subject: Re: Fixes boolean/SCM confusions, part 1. (issue 4875054)
Date: Fri, 19 Aug 2011 11:14:20 +0200

> I'm already writing a section called "C/Scheme interface" where I
> explain that scm_integer_p (x) == SCM_BOOL_T isn't correct.

Well, it works as long as scm_is_eq works the same as ==.  But that's an
implementation detail of Guile and not part of the Guile API.  Bypassing
the Guile API here does not buy us anything regarding efficiency, and it
is not helpful for debugging and newcomers who should not be required to
know internals of Guile.

Of course, this is bizarre for newcomers... But there's something else that actually mislead me before we started working on this.
In the Guile reference, it is written that scm_string_p returns #t or #f. And it is also written that scm_is_string returns 0 or 1. Because it isn't written SCM_BOOL_T and SCM_BOOL_F, I always thought 0 and 1 were Scheme values. This, of course, totally broke my understanding of these functions.
I pointed out this logical error in the piece of doc I will push.

It is somewhat amusing, by the way, that Lilypond's to_boolean is
required in order to let '() and #f be interpreted in the same manner.
It would seem that Lisp's conflating them into `nil' is not the worst
This also mislead me a long time ago.


reply via email to

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