https://bugs.ruby-lang.org/https://bugs.ruby-lang.org/favicon.ico?17113305112009-03-20T01:27:07ZRuby Issue Tracking SystemRuby master - Bug #1302: Strange behavior of callcchttps://bugs.ruby-lang.org/issues/1302?journal_id=36042009-03-20T01:27:07ZSarwen (Christophe Calves)calves@crans.org
<ul><li><strong>File</strong> <a href="/attachments/321">testcallcc.scm</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/321/testcallcc.scm">testcallcc.scm</a> added</li></ul><p>=begin<br>
I did the same code in scheme. I tried under drscheme and petite-chez-scheme, both give the same result:</p>
<p>x1 = (1)<br>
x2 = (2)<br>
x3 = (3)</p>
<p>as expected.</p>
<p>To run the code:</p>
<p>petite --script testcallcc.scm</p>
<p>=end</p> Ruby master - Bug #1302: Strange behavior of callcchttps://bugs.ruby-lang.org/issues/1302?journal_id=36052009-03-20T01:32:52ZSarwen (Christophe Calves)calves@crans.org
<ul></ul><p>=begin<br>
I just tried on ruby 1.8</p>
<a name="ruby-v"></a>
<h1 >ruby -v<a href="#ruby-v" class="wiki-anchor">¶</a></h1>
<p>ruby 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux]</p>
<p>There is the same bug.<br>
=end</p> Ruby master - Bug #1302: Strange behavior of callcchttps://bugs.ruby-lang.org/issues/1302?journal_id=36072009-03-20T09:59:16Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul></ul><p>=begin<br>
Hi,</p>
<p>At Thu, 19 Mar 2009 04:33:40 +0900,<br>
Christophe Calves wrote in <a href="/issues/1302">[ruby-core:22933]</a>:</p>
<blockquote>
<p>The code runs "[0].map" with a block which uses callcc to<br>
stop the execution of map and return the continuation. Later<br>
this continuation is called three times with three different<br>
values. The expected behavior is that these calls should<br>
result in three different computations. Each computation<br>
being the mapping with the corresponing value. Instead, the<br>
result is very strange.</p>
</blockquote>
<p>I don't consider it a bug.</p>
<p>This is caused by the implementation of Enumerable#map, not<br>
callcc. And the difference between callcctest.rb and<br>
testcallcc.scm would be resulted in because of the difference<br>
between Ruby's Array and Scheme's list.</p>
<p>--<br>
Nobu Nakada</p>
<p>=end</p> Ruby master - Bug #1302: Strange behavior of callcchttps://bugs.ruby-lang.org/issues/1302?journal_id=36162009-03-20T23:44:00ZSarwen (Christophe Calves)calves@crans.org
<ul><li><strong>File</strong> <a href="/attachments/323">callcctest_demo_map.rb</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/323/callcctest_demo_map.rb">callcctest_demo_map.rb</a> added</li></ul><p>=begin<br>
Hi</p>
<p>Thank you very much. I realized some tests that show what's going on. The code runs the above code with 5 different impelementations of Array.map. When i did the first test, i made the assertion that, on contrary to array.map! whish is not persistent, array.map would be persistent. Actually it is in most usages but apparently not when the continuation is run more than once.</p>
<p>I think that in the test, x1 being obtained by a map ( [0].map { .... } ), it would be good that x1 would not be modified the way it is. That is to include in the standard library one of the two last maps in the following code as a persistent-guaranteed map. They are certainly less efficient but avoid susprises when playing with continuations.<br>
=end</p> Ruby master - Bug #1302: Strange behavior of callcchttps://bugs.ruby-lang.org/issues/1302?journal_id=48192009-07-16T18:08:47Zyugui (Yuki Sonoda)yugui@yugui.jp
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Rejected</i></li></ul><p>=begin</p>
<p>=end</p>