Pretty sure it is the same — null is the sentinel value to indicate that the key/value is missing from the map; if missing, the value is calculated, stored, and returned.

In fact, the existing implementation is the one that doesn't handle null values, in the sense that if the underlying function returns null for a given input, it will not be memoized; the underlying function will be called each time the memoized function is called on a null-generating input.

Cheers,
Arya

On Feb 16, 2013, at 7:22 AM, Lars Hupel <notifications@github.com> wrote:

> In core/src/main/scala/scalaz/Memo.scala:
> 
> >  
> >    /** As with `mutableHashMapMemo`, but forget elements according to
> >      * GC pressure.
> >      */
> > -  def weakHashMapMemo[K, V]: Memo[K, V] = {
> > -    val a = new java.util.WeakHashMap[K, V]
> > +  def weakHashMapMemo[K, V]: Memo[K, V] = 
> > +    mutableMapMemo(new collection.mutable.WeakHashMap[K, V])
> Are you sure this has the same behaviour as before? The definition of getOrElseUpdate doesn't seem to take null values into account.
> 
> —
> Reply to this email directly or view it on GitHub.
>