<?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: Wanted: More elegant syntax for adding associations to hashes in PHP and Ruby</title>
	<atom:link href="http://blog.johnjosephbachir.org/2007/09/29/wanted-more-elegant-syntax-for-adding-associations-to-hashes-in-php-and-ruby/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.johnjosephbachir.org/2007/09/29/wanted-more-elegant-syntax-for-adding-associations-to-hashes-in-php-and-ruby/</link>
	<description>John Joseph Bachir's blog</description>
	<pubDate>Sat, 30 Aug 2008 16:25:37 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.1</generator>
		<item>
		<title>By: John</title>
		<link>http://blog.johnjosephbachir.org/2007/09/29/wanted-more-elegant-syntax-for-adding-associations-to-hashes-in-php-and-ruby/#comment-203246</link>
		<dc:creator>John</dc:creator>
		<pubDate>Sun, 30 Sep 2007 16:22:17 +0000</pubDate>
		<guid isPermaLink="false">http://blog.johnjosephbachir.org/2007/09/29/wanted-more-elegant-syntax-for-adding-associations-to-hashes-in-php-and-ruby/#comment-203246</guid>
		<description>That wasn't the part of the code I was illustrating, it's irrelevant. But here you go:

(looks like my syntax highlighter inserts a lot of linebreaks when used in comments...)

[ruby]
@hash.merge
  if @condition
    { :newkey =&gt; 'newvalue' }
  else
    {}
  end
# Becomes...
@hash + 
  if @condition
    { :newkey =&gt; 'newvalue' }
  else
    {}
  end
[/ruby]</description>
		<content:encoded><![CDATA[<p>That wasn't the part of the code I was illustrating, it's irrelevant. But here you go:</p>
<p>(looks like my syntax highlighter inserts a lot of linebreaks when used in comments...)</p>
<div class="igBar"><span id="lruby-1"><a href="#" onclick="javascript:showCodeTxt('ruby-1'); return false;">[click here for plain text]</a></span></div>
<div class="syntax_hilite"><span class="langName">RUBY:</span>
<div id="ruby-1">
<div class="ruby" style="font-family: monospace;">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0066ff; font-weight:bold;">@hash</span>.<span style="color:#9900CC;">merge</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#9966CC; font-weight:bold;">if</span> <span style="color:#0066ff; font-weight:bold;">@condition</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:newkey</span> =&gt; <span style="color:#996600;">'newvalue'</span> <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#9966CC; font-weight:bold;">else</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#9966CC; font-weight:bold;">end</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000; font-style:italic;"># Becomes...</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0066ff; font-weight:bold;">@hash</span> + </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#9966CC; font-weight:bold;">if</span> <span style="color:#0066ff; font-weight:bold;">@condition</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:newkey</span> =&gt; <span style="color:#996600;">'newvalue'</span> <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#9966CC; font-weight:bold;">else</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#9966CC; font-weight:bold;">end</span></div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matt Sayler</title>
		<link>http://blog.johnjosephbachir.org/2007/09/29/wanted-more-elegant-syntax-for-adding-associations-to-hashes-in-php-and-ruby/#comment-203087</link>
		<dc:creator>Matt Sayler</dc:creator>
		<pubDate>Sun, 30 Sep 2007 02:44:30 +0000</pubDate>
		<guid isPermaLink="false">http://blog.johnjosephbachir.org/2007/09/29/wanted-more-elegant-syntax-for-adding-associations-to-hashes-in-php-and-ruby/#comment-203087</guid>
		<description>I guess if you're worried about elegant.. why use the #$%!#$% ternary operator ?</description>
		<content:encoded><![CDATA[<p>I guess if you're worried about elegant.. why use the #$%!#$% ternary operator ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John</title>
		<link>http://blog.johnjosephbachir.org/2007/09/29/wanted-more-elegant-syntax-for-adding-associations-to-hashes-in-php-and-ruby/#comment-203084</link>
		<dc:creator>John</dc:creator>
		<pubDate>Sun, 30 Sep 2007 02:38:51 +0000</pubDate>
		<guid isPermaLink="false">http://blog.johnjosephbachir.org/2007/09/29/wanted-more-elegant-syntax-for-adding-associations-to-hashes-in-php-and-ruby/#comment-203084</guid>
		<description>Matt--

I am only adding a single element to the hash in my example, because... it's an example :)

How would you rewrite the code using an if statement?</description>
		<content:encoded><![CDATA[<p>Matt--</p>
<p>I am only adding a single element to the hash in my example, because... it's an example :)</p>
<p>How would you rewrite the code using an if statement?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anonymous</title>
		<link>http://blog.johnjosephbachir.org/2007/09/29/wanted-more-elegant-syntax-for-adding-associations-to-hashes-in-php-and-ruby/#comment-203074</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Sun, 30 Sep 2007 02:17:56 +0000</pubDate>
		<guid isPermaLink="false">http://blog.johnjosephbachir.org/2007/09/29/wanted-more-elegant-syntax-for-adding-associations-to-hashes-in-php-and-ruby/#comment-203074</guid>
		<description>Also, why in hte world are you using array_merge to add a single element to an array, anyway? 

I'm missing something..</description>
		<content:encoded><![CDATA[<p>Also, why in hte world are you using array_merge to add a single element to an array, anyway? </p>
<p>I'm missing something..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matt Sayler</title>
		<link>http://blog.johnjosephbachir.org/2007/09/29/wanted-more-elegant-syntax-for-adding-associations-to-hashes-in-php-and-ruby/#comment-203072</link>
		<dc:creator>Matt Sayler</dc:creator>
		<pubDate>Sun, 30 Sep 2007 02:12:36 +0000</pubDate>
		<guid isPermaLink="false">http://blog.johnjosephbachir.org/2007/09/29/wanted-more-elegant-syntax-for-adding-associations-to-hashes-in-php-and-ruby/#comment-203072</guid>
		<description>That's why god gave us if statements.</description>
		<content:encoded><![CDATA[<p>That's why god gave us if statements.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
