lilypond-devel
[Top][All Lists]
Advanced

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

Re: Use aligned-on-x-parent instead of other callbacks for some grobs (i


From: janek . lilypond
Subject: Re: Use aligned-on-x-parent instead of other callbacks for some grobs (issue 127860043 by address@hidden)
Date: Mon, 18 Aug 2014 06:09:44 +0000


https://codereview.appspot.com/127860043/diff/40001/lily/lily-guile.cc
File lily/lily-guile.cc (right):

https://codereview.appspot.com/127860043/diff/40001/lily/lily-guile.cc#newcode201
lily/lily-guile.cc:201: robust_scm2bool (SCM b, bool def)
On 2014/08/18 04:57:08, Keith wrote:
I am not sure, but I think this is a bad idea.
to_boolean() is robust to undefined symbols, returning #f, and a lot
of
define-grobs.scm depends on that convention.
If you add this variant, and people start writing C++ that treats
undefined
symbols as #t, we might get confused.

Hmm.  Good point.  However, to me the situation without robust_scm2bool
is also confusing: in fact, i was confused enough to write buggy code :(
As far as i can see, the code for getting non-boolean properties
follows the convention:

Type value = robust_scm2type (grob->get_property("prop-name"), default)

When writing code for issue 2245, I have initially tried to use
robust_scm2bool - which didn't exist.  As i was not aware of to_boolean,
i ended up with ly_scm2bool, which turned out to be a bad choice.

So, my question is: can we do something to make this more intuitive?

What about writing utility functions for getting and converting
properties in one step?  The current situation is not very elegant - the
code sometimes gets so long that it's hard to fit it in 80 chars limit.

https://codereview.appspot.com/127860043/



reply via email to

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