On Mar 14, 7:59 pm, Christophe Grand <christo...@cgrand.net> wrote:
> Well the fn passed to swap! can be retried so in case of "bad luck" you'll
> still create several delays.

You're absolutely right!

I wonder whether we can make any statement about the likeliness of
this happening in memoize6/7 vs. memoize7-variant or your memoize8,
although it's unlikely to occur in all scenarios so far that I've
wanted to use memoize in.

But nevertheless, it got me thinking: Does swap! always finish every
retry it does? So it won't stop in the middle because it discovered
that someone updated the atom in the meantime, correct? I guess It
will only be discovered by the final compare-and-set.

Answering myself, after checking Atom.java: Yes, that's how it works.

So the likeliness of multiple delays being created might actually have
increased in the latest memoize versions, as the "transaction" now can
take longer, in case it has to do the delay :) As mentioned, this
potential difference is probably of minor importance in most cases,
more important is to keep the fact that retries can happen in mind...

Thanks Christophe, and also Meikel, Michał, Laurent, André for all the
input. That was very useful!
Eugen

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