<?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"
	>
<channel>
	<title>Comments on: for() $DEITY&#8217;s sake, why?</title>
	<atom:link href="http://happygiraffe.net/blog/2008/04/02/for-deitys-sake-why/feed/" rel="self" type="application/rss+xml" />
	<link>http://happygiraffe.net/blog/2008/04/02/for-deitys-sake-why/</link>
	<description></description>
	<pubDate>Sat, 22 Nov 2008 09:10:13 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.3</generator>
		<item>
		<title>By: Dominic Mitchell</title>
		<link>http://happygiraffe.net/blog/2008/04/02/for-deitys-sake-why/#comment-534</link>
		<dc:creator>Dominic Mitchell</dc:creator>
		<pubDate>Wed, 02 Apr 2008 10:23:02 +0000</pubDate>
		<guid isPermaLink="false">tag:happygiraffe.net:Article12970#comment-534</guid>
		<description>&lt;p&gt;Ahhh…  That &lt;em&gt;does&lt;/em&gt; make sense.  Thank you,  I feel enlightened.&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>Ahhh…  That <em>does</em> make sense.  Thank you,  I feel enlightened.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Aristotle Pagaltzis</title>
		<link>http://happygiraffe.net/blog/2008/04/02/for-deitys-sake-why/#comment-533</link>
		<dc:creator>Aristotle Pagaltzis</dc:creator>
		<pubDate>Wed, 02 Apr 2008 10:13:44 +0000</pubDate>
		<guid isPermaLink="false">tag:happygiraffe.net:Article12970#comment-533</guid>
		<description>&lt;p&gt;It’s just a consequence of the fact that you can do this:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;my @foo = map { "foo$_" } 1..4;
s/foo/bar/ for @foo;
print "@foo\n";
# output: bar1 bar2 bar3 bar4&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;This works because the iterator is an alias for the value, not a copy, which is very much by design, not an implementation detail come feature. And it is in fact so incredibly useful in practice that I’ll happily live with the fact that it implies some extra legwork to preserve the last iteration’s iterator value past the loop. I only need &lt;em&gt;that&lt;/em&gt; extremely rarely, and I think having to spell it out actually helps readability by alerting the reader that this particular behaviour was intended by the original programmer.&lt;/p&gt;


	&lt;p&gt;To my knowledge this is actually unique about Perl. I wouldn’t have it any other way, and while it’s a very small thing, I always eventually find myself missing it in other languages.&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>It’s just a consequence of the fact that you can do this:</p>
<pre><code>my @foo = map { "foo$_" } 1..4;
s/foo/bar/ for @foo;
print "@foo\n";
# output: bar1 bar2 bar3 bar4</code></pre>
<p>This works because the iterator is an alias for the value, not a copy, which is very much by design, not an implementation detail come feature. And it is in fact so incredibly useful in practice that I’ll happily live with the fact that it implies some extra legwork to preserve the last iteration’s iterator value past the loop. I only need <em>that</em> extremely rarely, and I think having to spell it out actually helps readability by alerting the reader that this particular behaviour was intended by the original programmer.</p>
<p>To my knowledge this is actually unique about Perl. I wouldn’t have it any other way, and while it’s a very small thing, I always eventually find myself missing it in other languages.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
