guile-user
[Top][All Lists]
Advanced

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

Re: attempt to make a transparent binding


From: Oleg A. Paraschenko
Subject: Re: attempt to make a transparent binding
Date: Wed, 8 Dec 2004 10:21:27 +0300

  Hello Stephen,

  thank you for comments.

On 06 Dec 2004 11:26:30 -0600
Stephen Compall <address@hidden> wrote:

> "Oleg A. Paraschenko" <address@hidden> writes:
> 
> >   First, the data in memory are big enough, and full instantiation
> > of lists wastes resources, especially because I use only small part
> > of the data. Instead, I'd like to have lazy instantiation. Let
> > "memory->list" returns a special type of pair in which car and cdr
> > are instantiated on demand. Is it possible?
> 
> This is what Scheme's "promises" are for.  However, I do not know
> Guile's promise support, as I've never looked at that part of the
> source, and have never needed them myself.

  Nice suggestion. I've completely forgotten about Scheme promises.
They can't help me because I can't insert "force"s to the existing code,
but anyway now I have several ideas.

> 
> >   The second. Having Scheme data, I'd like to get the origin of this
> > data in the C program. Currently I think about mapping from SCMs to
> > C structures in C-Guile glue, but I'm afraid this is bad for garbage
> > collection.
> 
> I can't think of any other way.  If you were using smobs, the natural
> thing would be to use a slot for a pointer back to the C struct.
> However, you aren't.
> 
> As for garbage collection, you could drop the SCMs in a gc protected
> guardian, and remove objects you can pull from the guardian every time
> you look in your table.
> 
> The other solution, if you are really worried about resource usage, is
> to eliminate duplication by changing the internal representation of
> your program to use SCMs.  Then you could scm_permanent_object a
> variable containing a list of current SCMs that may only be live in C.
> Further transformation could open up the possibility of writing new
> parts of the program in Scheme, or rewriting buggy sections :)

  Thank you, I'll try to understand it.

> 
> --
> Stephen Compall or s11 or sirian
> 
> It's not reality or how you perceive things that's important -- it's
> what you're taking for it...
> 


-- 
Oleg 




reply via email to

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