in reply to Memoizing Methods

I'm realy confused. It appears that you want to be able to call a method with a value to save that value and then without a value to get the value. THen only if you don't call it with a value you want to call the actual method and store that value, and then calling it without a value gets that value. This seems realy confusing, at least the first part where you can send it the value you want it to save. Mostly you seem just to have attributes that sometimes you want to autoload from a method, so why not break them out a little? Getter and setter as methodname and then a seperate methods load_methodname or something like that? I think anyone looking at your code is going to be pretty confused unless already familary with your cacheing mechanism.


___________
Eric Hodges

Replies are listed 'Best First'.
Re^2: Memoizing Methods
by bduggan (Pilgrim) on Mar 29, 2006 at 18:01 UTC
    Interesting idea. Since load_methodname and setter have such similiar effects, it made sense to me to combine them. But I can see how distinguishing read-only parameterless cached methods from read-write attributes (via load_* for the former) would clarify things.