<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Avoiding nested blocks</title>
	<atom:link href="http://mediumexposure.com/avoiding-nested-blocks/feed/" rel="self" type="application/rss+xml" />
	<link>http://mediumexposure.com/avoiding-nested-blocks/</link>
	<description>by Maxim Chernyak</description>
	<lastBuildDate>Sat, 04 Sep 2010 14:49:17 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: Anonymous</title>
		<link>http://mediumexposure.com/avoiding-nested-blocks/comment-page-1/#comment-218</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Wed, 09 Sep 2009 21:50:38 +0000</pubDate>
		<guid isPermaLink="false">#comment-218</guid>
		<description>&lt;p&gt;dang true. my fault, thanks for your answer&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>dang true. my fault, thanks for your answer</p>]]></content:encoded>
	</item>
	<item>
		<title>By: hakunin</title>
		<link>http://mediumexposure.com/avoiding-nested-blocks/comment-page-1/#comment-196</link>
		<dc:creator>hakunin</dc:creator>
		<pubDate>Wed, 09 Sep 2009 15:09:33 +0000</pubDate>
		<guid isPermaLink="false">#comment-196</guid>
		<description>&lt;p&gt;This won&#039;t work because the block has to run nested within all stream-silencing blocks.&lt;/p&gt;

&lt;p&gt;&lt;ruby&gt;
silence_stream(particular_stream) do
  # code for which stream is silenced
end
&lt;/ruby&gt;&lt;/p&gt;

&lt;p&gt;In your case you&#039;re silencing all streams individually, and not running any code in them. Then in the end you&#039;re only silencing one last stream for &amp;block passed in. Basically &lt;code&gt;stream.each&lt;/code&gt; line in your example is meaningless.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<div style=""><p></p><p>This won&#8217;t work because the block has to run nested within all stream-silencing blocks.</p>

<p><ruby>
silence_stream(particular_stream) do
  # code for which stream is silenced
end
</ruby></p>

<p>In your case you&#8217;re silencing all streams individually, and not running any code in them. Then in the end you&#8217;re only silencing one last stream for &amp;block passed in. Basically

<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">stream.each</div></div>

line in your example is meaningless.</p></div>]]></content:encoded>
	</item>
	<item>
		<title>By: Anonymous</title>
		<link>http://mediumexposure.com/avoiding-nested-blocks/comment-page-1/#comment-129</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Wed, 09 Sep 2009 15:02:07 +0000</pubDate>
		<guid isPermaLink="false">#comment-129</guid>
		<description>&lt;p&gt;do something like
&lt;ruby&gt;
def silence_streams(*streams, &amp;block)
  s = streams.pop
  streams.each {&#124;s&#124; silence_stream(s){} }
  silence_stream s, &amp;block&lt;br /&gt;
end
&lt;/ruby&gt;
so the block doesn&#039;t get executed twice&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>do something like
<ruby>
def silence_streams(*streams, &amp;block)
  s = streams.pop
  streams.each {|s| silence_stream(s){} }
  silence_stream s, &amp;block<br />
end
</ruby>
so the block doesn&#8217;t get executed twice</p>]]></content:encoded>
	</item>
	<item>
		<title>By: hakunin</title>
		<link>http://mediumexposure.com/avoiding-nested-blocks/comment-page-1/#comment-195</link>
		<dc:creator>hakunin</dc:creator>
		<pubDate>Mon, 10 Aug 2009 16:53:25 +0000</pubDate>
		<guid isPermaLink="false">#comment-195</guid>
		<description>&lt;p&gt;Maybe I&#039;m misunderstanding but wouldn&#039;t this execute &lt;code&gt;&amp;block&lt;/code&gt; separately in each silence_stream? It looks like it&#039;s equivalent of saying sequentially.&lt;/p&gt;

&lt;p&gt;&lt;ruby&gt;
silence_stream(STDOUT) { same_code; }
silence_stream(STDERR) { same_code; }
&lt;/ruby&gt;&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<div style=""><p></p><p>Maybe I&#8217;m misunderstanding but wouldn&#8217;t this execute

<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&amp;amp;block</div></div>

separately in each silence_stream? It looks like it&#8217;s equivalent of saying sequentially.</p>

<p><ruby>
silence_stream(STDOUT) { same_code; }
silence_stream(STDERR) { same_code; }
</ruby></p></div>]]></content:encoded>
	</item>
	<item>
		<title>By: Nicolás Sanguinetti</title>
		<link>http://mediumexposure.com/avoiding-nested-blocks/comment-page-1/#comment-125</link>
		<dc:creator>Nicolás Sanguinetti</dc:creator>
		<pubDate>Mon, 10 Aug 2009 16:34:00 +0000</pubDate>
		<guid isPermaLink="false">#comment-125</guid>
		<description>&lt;p&gt;Why not&lt;/p&gt;

&lt;p&gt;&lt;ruby&gt;def silence_streams(*streams, &amp;block)
  streams.each {&#124;s&#124; silence_stream(s, &amp;block) }
end&lt;/ruby&gt;&lt;/p&gt;

&lt;p&gt;It&#039;s more concise, clearer at first sight, and more efficient, IMO.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Why not</p>

<p><ruby>def silence_streams(*streams, &amp;block)
  streams.each {|s| silence_stream(s, &amp;block) }
end</ruby></p>

<p>It&#8217;s more concise, clearer at first sight, and more efficient, IMO.</p>]]></content:encoded>
	</item>
</channel>
</rss>
