<?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: A trap to avoid with ruby assignments</title>
	<atom:link href="http://www.rubyfleebie.com/a-trap-to-avoid-with-ruby-assignments/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.rubyfleebie.com/a-trap-to-avoid-with-ruby-assignments/</link>
	<description>Because programming should be fun</description>
	<lastBuildDate>Thu, 15 Jul 2010 19:48:22 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Judith Blackburn</title>
		<link>http://www.rubyfleebie.com/a-trap-to-avoid-with-ruby-assignments/comment-page-1/#comment-809</link>
		<dc:creator>Judith Blackburn</dc:creator>
		<pubDate>Fri, 09 Jan 2009 11:49:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.rubyfleebie.com/a-trap-to-avoid-with-ruby-assignments/#comment-809</guid>
		<description>hi
zydprbknhvb02gn4
good luck</description>
		<content:encoded><![CDATA[<p>hi<br />
zydprbknhvb02gn4<br />
good luck</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sole</title>
		<link>http://www.rubyfleebie.com/a-trap-to-avoid-with-ruby-assignments/comment-page-1/#comment-34</link>
		<dc:creator>sole</dc:creator>
		<pubDate>Tue, 27 Mar 2007 07:10:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.rubyfleebie.com/a-trap-to-avoid-with-ruby-assignments/#comment-34</guid>
		<description>Cool one! I already *supposedly* knew this but reading it again it helped clarifying and settling the concepts. Coming from a non-ruby background, I always forget how the attributes and accessors work in ruby :D</description>
		<content:encoded><![CDATA[<p>Cool one! I already *supposedly* knew this but reading it again it helped clarifying and settling the concepts. Coming from a non-ruby background, I always forget how the attributes and accessors work in ruby :D</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Frank</title>
		<link>http://www.rubyfleebie.com/a-trap-to-avoid-with-ruby-assignments/comment-page-1/#comment-33</link>
		<dc:creator>Frank</dc:creator>
		<pubDate>Mon, 26 Mar 2007 23:57:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.rubyfleebie.com/a-trap-to-avoid-with-ruby-assignments/#comment-33</guid>
		<description>Thanks everyone for your comments, i really appreciate. Hugo, your comment made my day. Knowing that some people appreciate my work means a lot to me. It&#039;s cool to see your interest in the language. Ruby is one wild beast but to me it&#039;s the most interesting and elegant language out there.

Jörg, I didn&#039;t know about the attr keyword. Thanks for the input! Like you said however, I don&#039;t know why one would use it instead of the other more &quot;verbose&quot; helpers...

Is it some deprecated feature?</description>
		<content:encoded><![CDATA[<p>Thanks everyone for your comments, i really appreciate. Hugo, your comment made my day. Knowing that some people appreciate my work means a lot to me. It&#8217;s cool to see your interest in the language. Ruby is one wild beast but to me it&#8217;s the most interesting and elegant language out there.</p>
<p>Jörg, I didn&#8217;t know about the attr keyword. Thanks for the input! Like you said however, I don&#8217;t know why one would use it instead of the other more &#8220;verbose&#8221; helpers&#8230;</p>
<p>Is it some deprecated feature?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jörg W Mittag</title>
		<link>http://www.rubyfleebie.com/a-trap-to-avoid-with-ruby-assignments/comment-page-1/#comment-32</link>
		<dc:creator>Jörg W Mittag</dc:creator>
		<pubDate>Mon, 26 Mar 2007 21:41:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.rubyfleebie.com/a-trap-to-avoid-with-ruby-assignments/#comment-32</guid>
		<description>There&#039;s one more way to create readers and writers, somewhere in between writing your own and calling attr_accessor or attr_reader: attr.  attr takes a Symbol and an optional Boolean.  The Symbol is the name of the accessor and the Boolean determines whether a writer is also created.  The created accessor methods basically look exactly like the ones you demonstrated.

attr_accessor and attr_reader take any number of Symbols and basically just call attr(:sym, true) or attr(:sym) for each one.

However, I have no idea why and when one would actually want to use attr over attr_accessor.

jwm</description>
		<content:encoded><![CDATA[<p>There&#8217;s one more way to create readers and writers, somewhere in between writing your own and calling attr_accessor or attr_reader: attr.  attr takes a Symbol and an optional Boolean.  The Symbol is the name of the accessor and the Boolean determines whether a writer is also created.  The created accessor methods basically look exactly like the ones you demonstrated.</p>
<p>attr_accessor and attr_reader take any number of Symbols and basically just call attr(:sym, true) or attr(:sym) for each one.</p>
<p>However, I have no idea why and when one would actually want to use attr over attr_accessor.</p>
<p>jwm</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ben</title>
		<link>http://www.rubyfleebie.com/a-trap-to-avoid-with-ruby-assignments/comment-page-1/#comment-30</link>
		<dc:creator>Ben</dc:creator>
		<pubDate>Mon, 26 Mar 2007 19:54:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.rubyfleebie.com/a-trap-to-avoid-with-ruby-assignments/#comment-30</guid>
		<description>My mistake. For the longest time, I&#039;d assumed that every action boiled down to a method call in Ruby. Guess not:

&lt;code&gt;$ irb
irb&gt; hello = &#039;ted&#039;
=&gt; &#039;ted&#039;
irb&gt; def hello; &#039;bob&#039;; end
=&gt; nil
irb&gt; hello
=&gt; &#039;ted&#039;
irb&gt; hello()
=&gt; &#039;bob&#039;
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>My mistake. For the longest time, I&#8217;d assumed that every action boiled down to a method call in Ruby. Guess not:</p>
<p><code>$ irb<br />
irb&gt; hello = 'ted'<br />
=&gt; 'ted'<br />
irb&gt; def hello; 'bob'; end<br />
=&gt; nil<br />
irb&gt; hello<br />
=&gt; 'ted'<br />
irb&gt; hello()<br />
=&gt; 'bob'<br />
</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hugo</title>
		<link>http://www.rubyfleebie.com/a-trap-to-avoid-with-ruby-assignments/comment-page-1/#comment-29</link>
		<dc:creator>Hugo</dc:creator>
		<pubDate>Mon, 26 Mar 2007 19:41:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.rubyfleebie.com/a-trap-to-avoid-with-ruby-assignments/#comment-29</guid>
		<description>Hi, I&#039;m currently learning Ruby ( and, sure, Rails) and found your posts very interesting. I&#039;m start to understanding the whole thing behind Ruby and all beauty of the language :)

I understood why I use symbols all the times in Rails..

Tks</description>
		<content:encoded><![CDATA[<p>Hi, I&#8217;m currently learning Ruby ( and, sure, Rails) and found your posts very interesting. I&#8217;m start to understanding the whole thing behind Ruby and all beauty of the language :)</p>
<p>I understood why I use symbols all the times in Rails..</p>
<p>Tks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Frank</title>
		<link>http://www.rubyfleebie.com/a-trap-to-avoid-with-ruby-assignments/comment-page-1/#comment-28</link>
		<dc:creator>Frank</dc:creator>
		<pubDate>Mon, 26 Mar 2007 19:03:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.rubyfleebie.com/a-trap-to-avoid-with-ruby-assignments/#comment-28</guid>
		<description>Ben,

I&#039;m not sure to understand what you mean. if I write obj = MyClass.new, the equal sign isn&#039;t &quot;bound&quot; to any method name. This is what i was talking about.</description>
		<content:encoded><![CDATA[<p>Ben,</p>
<p>I&#8217;m not sure to understand what you mean. if I write obj = MyClass.new, the equal sign isn&#8217;t &#8220;bound&#8221; to any method name. This is what i was talking about.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ben</title>
		<link>http://www.rubyfleebie.com/a-trap-to-avoid-with-ruby-assignments/comment-page-1/#comment-27</link>
		<dc:creator>Ben</dc:creator>
		<pubDate>Mon, 26 Mar 2007 17:34:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.rubyfleebie.com/a-trap-to-avoid-with-ruby-assignments/#comment-27</guid>
		<description>The difference between the first and second cases is that instance variables in Ruby are essentially protected by default. There is no trap; assignment in Ruby is always performed using a method call.</description>
		<content:encoded><![CDATA[<p>The difference between the first and second cases is that instance variables in Ruby are essentially protected by default. There is no trap; assignment in Ruby is always performed using a method call.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
