unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* 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

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).