[Top][All Lists]

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

Re: Rational

From: David Kastrup
Subject: Re: Rational
Date: Tue, 22 May 2018 22:07:50 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

Hans Åberg <address@hidden> writes:

>> On 22 May 2018, at 20:45, David Kastrup <address@hidden> wrote:
>> LilyPond's "rational" type should indeed get replaced
>> by Guile's rational types which would seriously shift the threshold
>> where things start breaking apart at the cost of efficiency.
>> That's quite a lot of tedious work (I have some started patches for
>> different approaches to that) but of course if its seminal for someone's
>> _own_ work, the motivation for finishing that might be larger.
> Guile uses GMP internally, and it might be fairly easy to change the
> class Rational to use GMP. Have you considered that?

Pointless.  The principal problem is that Rational is a fixed size
struct without additional allocations to keep track of.  Guile's SCM
isn't, and GMP's numbers aren't.  The garbage collection situation
becomes more rather than less complicated by introducing yet another
SCM-connected GMP type to be collected via Guile.

The grunt work to be done is to make sure that each SCM-connected class
having Rational or Moment(!) members calls the respective mark hooks.
This was somewhat complicated by some Midi classes being heap-allocated
and containing Rational/Moment members: those Midi classes would have to
become SCM-connected.  I did some work on that, don't remember how
complete it was.

Of course, the kind of abuse one gets for that work is not exactly an

David Kastrup

reply via email to

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