| Date: Thu, 03 Sep 2009 21:34:04 -0400
 | From: "Aaron W. Hsu" <[email protected]>
 | 
 | ....
 | Personally, threading is a perfect example of something that I
 | don't think every implementation should be forced to have.  Why
 | should they?  Many many many programs are written without threads,
 | and platforms may not even provide them.  I agee that a standard
 | interface to using them would be nice, but we shouldn't force all
 | the implementations to have it; what do we gain by that?  Not
 | portability.

One can allow concurrency without mandating any interface to threads.

I would like to see R7RS change every circumstance for which R5RS
specifies an unspecified order of evaluation to allow concurrent
evaluation.  Thus, LET, LETREC, DO, and procedure calls would allow
concurrent evaluation, while LET* and LETREC* would require serial
execution.  R7RS would also need to introduce a mutual-exclusion
operation like SRFI-96's MAKE-EXCHANGER.

This change would allow advanced implementations to parallelize most
Scheme code, while implementations would be free to remain serial.

There are few places in Scheme programs which work correctly with any
order-of-evaluation which would not work with concurrent evaluation.
All functional code is concurrency-safe.  An example of an exception
is the use of a pseudo-random-number-generator having shared state:

(require 'random)
(+ (random 99) (random 99))

The concurrency-safe version could be written:

(require 'random)
(let* ((rnd1 (random 99))
       (rnd2 (random 99)))
   (+ rnd1 rnd2))

By the way, the SLIB random module detects and signals an error if it
is called concurrently (reentrantly) on the same random-state
byte-array.

_______________________________________________
r6rs-discuss mailing list
[email protected]
http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss

Reply via email to