https://redmine.ruby-lang.org/https://redmine.ruby-lang.org/favicon.ico?17113305112014-08-07T12:51:37ZRuby Issue Tracking SystemRuby master - Bug #10113: Ruby memoization behaving oddly when using hash keys with spaceshttps://redmine.ruby-lang.org/issues/10113?journal_id=482312014-08-07T12:51:37Zcesario (Franck Verrot)franck@verrot.fr
<ul></ul><p>Ron Arias wrote:</p>
<blockquote>
<p>Trying to use simple Hash memoization with a ruby hash in a class method, it "fails" when having spaces as the hash key. Example code is attached.<br>
When calling the memoization method, it fails to maintain the instance variable. It resets the variable every time the method is called.<br>
When not having spaces in the key of the Hash, it works as it should, memoizing the variable.</p>
</blockquote>
<p>I can only reproduce the behavior you are describing if I make the "heavy_calculations" method return nil or false. Do you have any specific work done in this method?</p>
<blockquote>
<p>P.S. Despite my ruby version indicated bellow, it fails in the newest as well.</p>
</blockquote>
<p>I run on ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-darwin13.0].</p> Ruby master - Bug #10113: Ruby memoization behaving oddly when using hash keys with spaceshttps://redmine.ruby-lang.org/issues/10113?journal_id=484652014-08-24T15:15:00Znagachika (Tomoyuki Chikanaga)nagachika00@gmail.com
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Feedback</i></li></ul><p>Hello, Ron. Thank you for your report.<br>
But I cannot understand what is the "fail" you mean. Please give us a self-contained executable script to clarify the point.</p>
<p>Thanks.</p> Ruby master - Bug #10113: Ruby memoization behaving oddly when using hash keys with spaceshttps://redmine.ruby-lang.org/issues/10113?journal_id=492702014-10-07T20:08:42Zmarcandre (Marc-Andre Lafortune)marcandre-ruby-core@marc-andre.ca
<ul><li><strong>Status</strong> changed from <i>Feedback</i> to <i>Rejected</i></li></ul><p>No feedback, so closing.<br>
I can't see how this could possibly "fail".</p>