lilypond-devel
[Top][All Lists]
Advanced

[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 21:04:25 +0000

On 2011/08/18 18:01:36, Carl wrote:
On 2011/08/18 15:46:43, dak wrote:

>

http://codereview.appspot.com/4875054/diff/8002/lily/bar-check-iterator.cc#newcode52
> lily/bar-check-iterator.cc:52: if (scm_is_true (tr->get_property
> ("ignoreBarChecks")))
> 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.

It depends.  If you want to have unset properties default to #t, then
scm_is_true is correct.

If you want to have them default to #f, then to_boolean is clearly the
correct
way to go.

If you want to have a different default, depending on the property,
then we
should have a robust_scm2bool that should be used in these cases.

Well, if we have properties that should default to #t (do we really have
any of those?) then we should likely use something like to_boolean_or_t
and to_boolean_or_f instead of scm_is_true and to_boolean.  Using the
latter is far too obscure and does not make the programmer's intention
obvious.

http://codereview.appspot.com/4875054/



reply via email to

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