From: Lynn Winebarger <owinebar@indiana.edu>
Subject: Re: to serialize/deserialize closures; and multithreading
Date: Thu, 25 Mar 2004 13:11:32 -0500 [thread overview]
Message-ID: <406320D4.4030102@indiana.edu> (raw)
In-Reply-To: 4063144B.8050705@indiana.edu
On the other hand, you could just rely on guile's printer/reader
syntax and use that on the environment to export it and the
global variables. I don't know if it prints everything in a
uniquely readable way, but it should handle standard scheme
that way.
And environments in guile (last time I looked at the
evaluator) really are just binding lists. With deBruijn indices.
I can't remember exactly. Use the source.
Lynn
Lynn Winebarger wrote:
> It's an interesting question all right. What's the purpose of the
> "migration"?
> Technically speaking, a closure is just a pair of pointers to its
> code and
> its environment. You could create a new "foreign reference" type (tag)
> that
> would cause these to be looked up on the original computer whenever you
> needed
> them. That would handle synchronization. Of course, you could also
> make copies
> of everything. I think tags are constant over all architechtures (last
> I looked)
> but there are run-time allocated types that you'd have to do some work for
> (I think - I don't remember what they're called).
> Anyway, besides taking care of the tags/synchronizing run-time
> allocated types/
> handling endianness issues, you'd need to munge pointers according to
> whereever
> they would be newly allocated on the new machine. It would probably be
> easiest
> to just number copies of the cells from 0 to whatever for the transport
> over and the
> allocator on the other end could relabel them to the actual values.
> Also, you'd need to check that any symbols referenced by the code or
> variables were
> actually in existence in the new guile instance's symbol table. And
> that global
> variables referenced by the code got copied (as well as the lexical
> variables).
> So will be recursively nasty.
>
> Good Luck.
>
> Lynn
>
> Greg Troxel wrote:
>
>> 1. If I have a scheme value that is a closure, is there any way that
>> I can
>> serialize this closure (from C code) into a form that it can be
>> deserialized back into a SCM closure variable (again, by C code)? I
>> can
>> assume for this question that both ends of the serial line are
>> running the
>> same version of gnu guile and my software, but cannot assume that both
>> ends are running on the same computer architecture. Would it instead
>> only be possible for me to transfer closures as their scheme source.
>>
>> I'm not even sure it is well-defined what it means to migrate a
>> closure. Should a mutation on the new computer of a captured variable
>> affect the old computer?
>>
>
>
>
>
> _______________________________________________
> Guile-user mailing list
> Guile-user@gnu.org
> http://mail.gnu.org/mailman/listinfo/guile-user
>
>
>
_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user
next prev parent reply other threads:[~2004-03-25 18:11 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-03-25 6:19 to serialize/deserialize closures; and multithreading Nicholas Paul Johnson
2004-03-25 6:43 ` Paul Jarc
2004-03-25 12:40 ` Greg Troxel
2004-03-25 17:18 ` Lynn Winebarger
2004-03-25 18:11 ` Lynn Winebarger [this message]
2004-03-25 19:55 ` Paul Jarc
-- strict thread matches above, loose matches on Subject: below --
2004-03-25 22:38 Faraz Shahbazker
2004-03-26 13:05 ` rm
2004-03-26 15:22 ` Nicholas Paul Johnson
2004-03-26 20:02 Faraz Shahbazker
2004-03-26 20:35 ` Andreas Rottmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=406320D4.4030102@indiana.edu \
--to=owinebar@indiana.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).