* Re: Re: to serialize/deserialize closures; and multithreading
@ 2004-03-26 20:02 Faraz Shahbazker
2004-03-26 20:35 ` Andreas Rottmann
0 siblings, 1 reply; 2+ messages in thread
From: Faraz Shahbazker @ 2004-03-26 20:02 UTC (permalink / raw)
Cc: nickjohnson, guile-user
[-- Attachment #1.1: Type: text/html, Size: 2934 bytes --]
[-- Attachment #1.2: Type: text/plain, Size: 2184 bytes --]
The problem with Kali and other distributed Scheme
implementations (and there are quite a few) is that most of
them are built around the imperative style of parallel
computation -- result: things get ugly quickly for complex
programs. You could end-up writing C-like programs in
Scheme.
IMHO the ideal system would be built around pure
functional style (using MultiLisp type parallel annotations
like future/touch/pcall). This category is also known as
para-functional languages. It has been explored reasonably in
ML/Haskell, but little work of this nature has been done in
Scheme/Lisp so far.....
> Autsch, that does get rather expensive when closures/continuation
> are used (something that does happen occasionally in functional
> programming ;-)
That I accept. It can be speeded up by building the
transformation into the compiler, something which is not possible
with guile - bigloo perhaps would be a better choice for such work.
But it is difficult to leave guile for 2 reasons :
1. it's got the "GNU" in it's name
2. SCM API is too good - absolutely love it. I don't think anyone
can provide a better extensibility for Scheme than what we have here.
As an aside : for functional purists like me, we should built
future/touch constructs into guile - they are a lot of fun.
Try out these prototypes =>
(Note : these are not actually correct - the simple semantics fail
in the presence of mutations/continuations. A proper implementation
would have to be done in C using Guile-internals)
It basically works like delay/force except that any-thing
that is "future"d returns a place-holder immediately and starts
concurrent computation. When the value is required, you "touch"
the place-holder, causing a block until the computation completes.
(defmacro future (expr)
`(let ((ans (cons "#<future>" (cons #f #f))))
(set-car! (cdr ans)
(begin-thread
(set-cdr! (cdr ans) ((lambda () ,expr)))))
ans))
(defmacro touch (future-val)
`(begin
(join-thread (car (cdr ,future-val)))
(cdr (cdr ,future-val))))
regards,
- faraz
[-- Attachment #2: Type: text/plain, Size: 139 bytes --]
_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: to serialize/deserialize closures; and multithreading
2004-03-26 20:02 Re: to serialize/deserialize closures; and multithreading Faraz Shahbazker
@ 2004-03-26 20:35 ` Andreas Rottmann
0 siblings, 0 replies; 2+ messages in thread
From: Andreas Rottmann @ 2004-03-26 20:35 UTC (permalink / raw)
"Faraz Shahbazker" <faraz_ms@rediffmail.com> writes:
> That I accept. It can be speeded up by building the
> transformation into the compiler, something which is not possible
> with guile - bigloo perhaps would be a better choice for such work.
> But it is difficult to leave guile for 2 reasons :
>
> 1. it's got the "GNU" in it's name
> 2. SCM API is too good - absolutely love it. I don't think anyone
> can provide a better extensibility for Scheme than what we have here.
>
Have a look at Pika's API - it's cleaner (IMHO) and more general, due
to passing only location of SCM values (which allows easier/better GC)
and passing an 'arena' (roughly a interpreter instance), which allows
for more than one Scheme "subsystem" in one program; each such
subsystem can have a different memory pool size, independent GC,
... OTOH, this tends to make the C code more verbose. Example:
t_scm_error
scm_ref_list_elt (t_scm_word * result, t_scm_arena arena, t_scm_word * list,
ssize_t elt)
{
struct ref_locals
{
SCM_FRAME;
t_scm_word tail;
} l;
t_scm_error status = 0;
SCM_PROTECT_FRAME (l);
status = scm_list_tail (&l.tail, arena, list, elt);
if (status == 0)
{
scm_ref_pair_car (result, arena, &l.tail);
}
SCM_UNPROTECT_FRAME (l);
return status;
}
Cheers, Andy
--
Andreas Rottmann | Rotty@ICQ | 118634484@ICQ | a.rottmann@gmx.at
http://yi.org/rotty | GnuPG Key: http://yi.org/rotty/gpg.asc
Fingerprint | DFB4 4EB4 78A4 5EEE 6219 F228 F92F CFC5 01FD 5B62
Make free software, not war!
_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-03-26 20:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-03-26 20:02 Re: to serialize/deserialize closures; and multithreading Faraz Shahbazker
2004-03-26 20:35 ` Andreas Rottmann
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).