On Sat, Apr 17, 2010 at 11:07 PM, alux <alu...@googlemail.com> wrote:
> Hello Per,
>
> thats very cool! Many thanks! Completely solves my problem. (As far as
> I can see :-)
>
> I'm not sure whether I completely understand the implications of the
> nondeterminism you described; will think about it. You say "When each
> promise can only be written by a single writer.." - I assume you mean
> this as "Even if ..". Or am I on a wrong track?

No. The issue I was getting at with that statement is that when a
promise is accessible to multiple potential writers there is a race as
to who delivers on the promise first. All the runner-ups will fail.
Who is the winner and who are the runner-ups is nondeterministic. It
should probably be considered a bug in your code if that possibility
even exists. In fact, I would argue for separating the capability to
write a promise and a read promise, so that you can prevent this from
happening accidentally. You can then hand out the reading capability
liberally while being more careful with the writing capability.

As for the nondeterminism issue with readiness checking: Take the
simplest case of a single reader and a single writer. If the reader's
only option is to block on the read then it works like Unix pipes: the
relative schedule interleaving of the reader and writer is irrelevant
to the ultimate outcome. However, if the reader can check to see if
the promise is ready (the analogue in the Unix world would be if the
reader does a select() on the file descriptor before reading it) then
there is at least the potential for a harmful kind of nondeterminism
where the outcome changes materially depending on whether the reader
or writer wins the race.

-Per

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to