lilypond-devel
[Top][All Lists]
Advanced

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

Re: Pitch alterations use SCM rather than flower rationals (issue 106190


From: dschudy
Subject: Re: Pitch alterations use SCM rather than flower rationals (issue 106190043 by address@hidden)
Date: Fri, 27 Jun 2014 04:06:40 +0000

Using Guile rationals is good on principle, but it's not great for
readability. It makes arithmetic and comparisons much more verbose, and
type declarations less informative. This isn't much of a problem for
pitch alterations (since it's balanced by the reduced hassle of
converting between the two representations), but it would be if all of
Lilypond's rational arithmetic were converted to Guile rationals. Is
there a way to make this less awkward?

We can't just overload the arithmetic and comparison operators to work
on Scheme numbers, because SCM is a pointer type so it already has them.

Rational could become a wrapper around a Guile rational, but that's not
much simpler than the status quo.

Convenience functions for things like scm_is_true(scm_less_p(...)) would
make comparisons a little less verbose (and reduce the risk of
forgetting scm_is_true).

https://codereview.appspot.com/106190043/



reply via email to

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