[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Couple things...
On Fri, 9 Jan 2004, Bradd W. Szonye wrote:
>For example, if C code needs access to a Scheme number, then allow it to
>ask for a handle to the number. When it wants the value of that number,
>use a handle->int or handle->double function. If C code needs to access
>arbitrary Scheme data, use something like handle->malloc that allocates
>a copy that C can stomp on all it wants.
>Sorry for the vagueness -- I've got a head cold, and it's hard to think
>straight. If I understand him correctly, this is similar to the approach
>that Tom Lord advocates. Arbitrary C code *can* deal with Scheme data,
>but it doesn't actually touch the heap; all of the "heap critical
>sections" are in the FFI itself.
I think that's best. For one thing, it makes the job of optimizing
scheme code a lot easier by making all mutations go through an explicit
call in the FFI. That allows you to know when mutations are happening
and decide how to handle it.