-
Notifications
You must be signed in to change notification settings - Fork 21.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed bc5896e, and added test case for the caching bug it originally …
…introduced.
- Loading branch information
Showing
4 changed files
with
13 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55adaa2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so… this pretty much means you never run this extremely useful piece of code you added to Rails core, correct?
55adaa2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What never runs?
55adaa2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you talking about “testing”, it caused a problem in development mode with cache reloading. We didn’t exactly have test coverage for that at the time.
55adaa2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like at the moment in time bc5896e was committed with this problem no production applications were using this uber cool mezmorize feature. How come? It’s so valuable and beats ||= every possible way. Josh, can you explain?
55adaa2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don’t know if it’s just early or what, but I can’t tell if this is supposed to be sarcasm or not. :-\
55adaa2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@michaelklishin: But without abstracting ||= users would have to use the actual Ruby language. Yuck! :)
55adaa2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@GMFlash & michaelklishin:
What do you have against “memoize”? It doesn’t prevent one from still using ||=, it’s just another way of doing the same thing, a “more declarative” way as stated in the documentation of “memoize”.
And it has its pluses: it makes the code of the memoized method clearer (lines of code the result of should be cached are not offset next to or underneath the “@expensive ||=”), and more importantly: it does memoize nil and false results like you would expect.
55adaa2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ZOMFG
55adaa2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ZOMFG(&:alias_method_chain)
55adaa2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lifo: would you care to elaborate?
55adaa2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Michael,
If you’re not going to add any value with your comments, can I suggest you just don’t bother making them. If you have something useful to add we’d love to hear from you either here or on the mailing list. If you’re just going to troll spouting underinformed opinions based on FUD just save your time and ours and don’t bother.
55adaa2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think lifo had on mind that alias_method_chain is the same as memoize in a way: declarative, easier, dry, etc. than aliasing by hand. It’s a pattern, so fleshing it out as a method is a good idea.