Andrei Alexandrescu Wrote:

> Jason House wrote:
> > Walter Bright Wrote:
> > 
> >> Michel Fortin wrote:
> >>> Hum, could the compiler be trusted to add the memoization code to pure 
> >>> functions so they can stay pure?
> >> If the compiler does general memoization on pure functions, all it has 
> >> to do is use the bits of the arguments passed on the stack to the 
> >> function as an index into an associative array of the return values.
> >>  
> >> The problem is identifying if this would be faster than recomputing the 
> >> return value.
> > 
> > What about a compiler hint similar to inline or register?
> 
> Maybe making a conscious effort to leave the language feature as a last 
> resort action would be better. Creating a memoization feature is a fish, 
> creating a language that allows implementing memoization is fishing. :o/
> 
> Andrei

I chose nearly dead keywords for a reason ;) If I got Walter to think about how 
to implement "pure" memoizers for an extra half hour, I will consider myself 
highly successful. I must leave the fishing discussion up to the two of you in 
a coffee shop! (I'd love to sit in and participate with that discussion, but 
online forums make the conversation far too difficult) 

Reply via email to