[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: dak
Subject: Re: Fixes boolean/SCM confusions, part 1. (issue 4875054)
Date: Thu, 18 Aug 2011 15:46:43 +0000
File lily/ (right):
lily/ Rational sig_alter = !scm_is_false
On 2011/08/18 14:18:45, Reinhold wrote:
On 2011/08/18 14:03:06, C├ęcile Hauchemaille wrote:
> So, might scm_is_pair also work ?

Yes, of course, that's the correct check...

It is a check that will work correctly.  However, it is not idiomatic.
The description for assoc and its friends will state that assoc will
return #f when no association could be found.  It does not state "will
return something that is not a pair", even though #f is the only
possible non-pair value.

So in order to match the check best to the description of the function,
I'd really check against false.

scm_is_pair will definitely work just as reliably for the computer, but
I think for humans, the check for false requires less thinking.
File lily/ (right):
lily/ if (scm_is_true (tr->get_property
As I already explained: you can't replace to_boolean with scm_is_true,
since to_boolean( '() ) -> 0, whereas scm_is_true ( '() ) -> 1 (I
apologize for the mixture of X and Scheme syntax), and '() is
_definitely_ one value that needs to be interpreted as false in the
context of boolean properties.
lily/ if (scm_is_true (tr->get_property
Again, scm_is_true is wrong here.

reply via email to

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