This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: gh_scm2doubles and friends



> Jim Blandy <jimb@red-bean.com> writes:
> 
> >   SCM gh_unlease_doubles (gh_lease LEASE)
> > 
> >     Convert the array returned by the function which returned LEASE
> >     into a Scheme vector of the appropriate type.  The returned object
> >     may or may not be identical to the one passed to the original
> >     function.
> 
> But we should add that gh_unlease_doubles also frees the LEASE.

Yes, that's right.

> BTW, there's the question whether gh_unlease_doubles will return a
> scm_tc7_dvect or a scm_tc7_vector.
> 
> One solution is that unlease returns the same type as the original
> vector (the one which was leased).
> 
> Maybe this was what you meant?

I'm not sure.  I like the idea of the lease remembering the type of
the leased vector, and having that be the default behavior, but I
imagine it would be useful to specify the return type, and have the
copy take place only if a) the leased C array shares space with the
leased vector, and b) the requested return type is different from that
of the leased vector.  Note that, if gh_lease_doubles made a copy of
the vector, you don't need to do a second copy to turn it into a
uniform vector of doubles.