guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Guile fibers return values


From: John Cowan
Subject: Re: Guile fibers return values
Date: Mon, 6 Jan 2020 20:36:25 -0500

On Mon, Jan 6, 2020 at 5:45 PM Zelphir Kaltstahl <address@hidden>
wrote:

I think that is a typo maybe? The futures guide says:
>
> "The (ice-9 futures) module provides futures, a construct for fine-grain
> parallelism."
>

I know, and I think that's an error (or rather a confusing point) in the
docs.  It should say "for fine-grained concurrency".


> Or do you say this,
> because on a single core machine, there would be no parallelism and thus
> one cannot say, that Guile's futures will enable parallelism in general,
> but can say, that they in general enable concurrency?
>

Just so.


> I think of "promises" as something that enables asynchronous execution.
>

Scheme promises are described in R7RS 4.2.5.  They are basically just
memoized closures.  When you create one it sits there until you force it
and then the closure is invoked and you get a result.  If you force it
again, you just get the result without any invocation.

So you can think of this as a degenerate Guile future / Racket thread that
doesn't even start until it is touched (by forcing it), or as a degenerate
Racket future / Guile parallel construct that tries to run in parallel but
is immediately unable to do so, so it has to wait until it is touched (also
by forcing it).  But promises don't provide you with either concurrency or
parallelism in themselves, so they are only useful to help with
understanding.

Don't beat me for this: "Just like in JavaScript" basically :D
>

JS promises, I think, are futures.
https://en.wikipedia.org/wiki/Futures_and_promises shows just how confusing
the terminology is.



John Cowan          http://vrici.lojban.org/~cowan        address@hidden
Fundamental thinking is ha-ard.  Let's go ideology-shopping.
                        --Philosopher Barbie


reply via email to

[Prev in Thread] Current Thread [Next in Thread]