[e-lang] Non-transparent memoization: is this safe?

Kevin Reid kpreid at mac.com
Thu May 18 12:13:27 EDT 2006


On May 17, 2006, at 22:06, Mark S. Miller wrote:

> Kevin Reid wrote:
>> Is it OK to consider safe a memoizer which instead memoizes results
>> if they are just DeepFrozen?
>
> Well, it is *safe*, in the sense that the resulting object may  
> still safely be deemed DeepFrozen. But since it isn't equivalent to  
> the original function, I'm not sure whether it is still a memoizer.  
> Is there an accepted sense of what "memoize" means, such that we  
> can tell whether we should adopt a different name?

If E had a pointer-equality primitive, then the memoizer we have  
would be making an observable difference by returning pointer-equal  
results that would not have been so otherwise. Since most other  
languages have such primitives, any memoizer in those languages makes  
an observable difference.

So, at the moment I don't think we gain anything by adopting a more  
strict definition.

However, there might be benefit from giving this operation a  
particular name that is not "memoize".

Can you think of any such name?

Also, what is an appropriate name for the option which enables this  
behavior?


(Another consequence: If the memoizer also enforces that all calls  
and results /are/ DeepFrozen, as opposed to passing them on without  
caching, then all calls to the memoized object are truly constant.)

-- 
Kevin Reid                            <http://homepage.mac.com/kpreid/>




More information about the e-lang mailing list