Carl Sorensen <c_soren...@byu.edu> writes: > On 11/18/16 8:11 AM, "David Kastrup" <d...@gnu.org> wrote: > >>Carl Sorensen <c_soren...@byu.edu> writes: >> >>> On 11/18/16 2:46 AM, "David Kastrup" <d...@gnu.org> wrote: >>> >>>> >>>> >>>>GMP is already linked into Guile exactly for that purpose. It would not >>>>really make a lot of sense to use it independently. >>> >>> You are certainly more qualified than me to comment on this. However, >>> it appeared to me that using the C++ interface to GMP allowed the >>> memory allocation problem to be handled more easily from C++. But I >>> haven't tried any of it. >> >>It would cause a lot of additional heap churn for passing around the >>Rational type (it is usually passed by value rather than by reference). >>Using Guile instead would mean that only references (namely an Scm >>value) are passed around which do not require allocation/deallocation >>for multiple "copies". >> >>We really don't want to open the can of worms of an additional memory >>management subsystem. > > That makes sense. > > Thanks for enlightening me.
Well, it's a valid idea and certainly one that would require touching less code overall. But it would put even more of a separation between Guile's rationals and the stuff we work with in C++ Moment structures. I've given it thought of my own and admittedly made my own decision process without bothering to involve anybody else in the discussion. In the long haul it is obviously the business for the person doing the actual implementation to make those decisions. Even Guile 1.8 has -- C Function: void scm_to_mpz (SCM val, mpz_t rop) Assign VAL to the multiple precision integer ROP. VAL must be an exact integer, otherwise an error will be signalled. ROP must have been initialized with `mpz_init' before this function is called. When ROP is no longer needed the occupied space must be freed with `mpz_clear'. *Note Initializing Integers: (gmp)Initializing Integers, for details. -- C Function: SCM scm_from_mpz (mpz_t val) Return the `SCM' value that represents VAL. so one could bounce the constituents of rationals between libgmp and Guile. But, well, ugh. -- David Kastrup _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user