[racket-dev] Making --enable -places the default.

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Tue Mar 29 09:38:54 EDT 2011

At Tue, 29 Mar 2011 08:46:06 -0400, Sam Tobin-Hochstadt wrote:
> I just meant that
> 
> (sync (future (lambda () ...)))
> 
> should be the same as
> 
> (touch (future (lambda () ...)))
> 
> or is that hard for future-safety reasons as well?

I'm not convinced that it makes sense. When you create a future,
there's no guarantee that the future's thunk will run concurrently with
the main computation (i.e., a future may provide parallelism, but it's
not intended for concurrency). So, if you simply `sync' on the future's
completion, it won't necessarily ever complete, because no one is
necessarily demanding the result.

You can put concurrency and parallelism together like this, I suppose:

  (sync (thread (lambda () (touch (future ...)))))

In that case, there's a clear demand for a future's result, a sensible
synchronization between concurrent tasks, and an opportunity for
parallelism.



Posted on the dev mailing list.