Purity (D2 standard libraries / object.d)

Walter Bright newshound1 at digitalmars.com
Sat Jan 10 15:36:10 PST 2009


dsimcha wrote:
> You misunderstood the question.  I mean, at the implementation level, even though
> it wouldn't be visible to the programmer, the AA that did the memoization would
> have to be mutable so it could be modified when a new value was to be memoized.
> This is where the threading issues would come in.  What I was saying is that
> synchronizing on this would be bad for obvious reasons, and TLS would still not be
> great because you wouldn't be able to share memoized values across threads.

You're right, I hadn't thought of that. But you could do a per-thread 
memoization using thread local storage. No sync problems.



More information about the Digitalmars-d mailing list