<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.1.2" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: Use self explicitly</title>
	<link>http://www.rubyfleebie.com/use-self-explicitly/</link>
	<description>Because programming should be fun</description>
	<pubDate>Mon, 22 Mar 2010 00:33:32 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.1.2</generator>

	<item>
		<title>By: Gabe</title>
		<link>http://www.rubyfleebie.com/use-self-explicitly/#comment-136</link>
		<author>Gabe</author>
		<pubDate>Tue, 17 Apr 2007 18:52:45 +0000</pubDate>
		<guid>http://www.rubyfleebie.com/use-self-explicitly/#comment-136</guid>
					<description>This is one of those simple things I didn't know until I read Ruby for Rails.  I highly recommend that book for illuminating numerous small details like this.  Pickaxe is a great reference, but it glosses over a lot of those details in favor of a comprehensive picture of the language.

Another one of these little gotchas is that referencing a non-existent local variable or method raises an exception, whereas a non-existent instance variable returns nil.</description>
		<content:encoded><![CDATA[<p>This is one of those simple things I didn&#8217;t know until I read Ruby for Rails.  I highly recommend that book for illuminating numerous small details like this.  Pickaxe is a great reference, but it glosses over a lot of those details in favor of a comprehensive picture of the language.</p>
<p>Another one of these little gotchas is that referencing a non-existent local variable or method raises an exception, whereas a non-existent instance variable returns nil.</p>
]]></content:encoded>
				</item>
	<item>
		<title>By: James Crisp &#187; Can you spot the bug?</title>
		<link>http://www.rubyfleebie.com/use-self-explicitly/#comment-309</link>
		<author>James Crisp &#187; Can you spot the bug?</author>
		<pubDate>Sat, 28 Jul 2007 09:20:24 +0000</pubDate>
		<guid>http://www.rubyfleebie.com/use-self-explicitly/#comment-309</guid>
					<description>[...] The answer lies in the fact that Ruby requires an explicit self reference when using attribute writers (aka, property setters) within the class itself. This feels clunky to me, but for your information, here&#8217;s a rationalisation of the explicit self requirement. [...]</description>
		<content:encoded><![CDATA[<p>[&#8230;] The answer lies in the fact that Ruby requires an explicit self reference when using attribute writers (aka, property setters) within the class itself. This feels clunky to me, but for your information, here&#8217;s a rationalisation of the explicit self requirement. [&#8230;]</p>
]]></content:encoded>
				</item>
	<item>
		<title>By: Ruby&#8217;s not ready - glyphobet • глыфобет • γλυφοβετ</title>
		<link>http://www.rubyfleebie.com/use-self-explicitly/#comment-553</link>
		<author>Ruby&#8217;s not ready - glyphobet • глыфобет • γλυφοβετ</author>
		<pubDate>Mon, 07 Apr 2008 20:31:44 +0000</pubDate>
		<guid>http://www.rubyfleebie.com/use-self-explicitly/#comment-553</guid>
					<description>[...] at least one case that requires self as an explicit reciever: when calling an attribute writer. Otherwise you&#8217;re just shadowing the attribute writer method locally. It&#8217;s not clear [...]</description>
		<content:encoded><![CDATA[<p>[&#8230;] at least one case that requires self as an explicit reciever: when calling an attribute writer. Otherwise you&#8217;re just shadowing the attribute writer method locally. It&#8217;s not clear [&#8230;]</p>
]]></content:encoded>
				</item>
	<item>
		<title>By: I was just thinkin&#8217;&#8230; &#187; Rails ActiveRecord callback gotcha!</title>
		<link>http://www.rubyfleebie.com/use-self-explicitly/#comment-842</link>
		<author>I was just thinkin&#8217;&#8230; &#187; Rails ActiveRecord callback gotcha!</author>
		<pubDate>Tue, 09 Jun 2009 14:09:29 +0000</pubDate>
		<guid>http://www.rubyfleebie.com/use-self-explicitly/#comment-842</guid>
					<description>[...] @self.author_id=1@ as making a method call. Which makes perfect sense when you think about it see &#8220;Use self explicitly&#8221; for more details. (thanks to Craig Webster and Florian Gilcher, via Twitter for clearing this up [...]</description>
		<content:encoded><![CDATA[<p>[&#8230;] @self.author_id=1@ as making a method call. Which makes perfect sense when you think about it see &#8220;Use self explicitly&#8221; for more details. (thanks to Craig Webster and Florian Gilcher, via Twitter for clearing this up [&#8230;]</p>
]]></content:encoded>
				</item>
	<item>
		<title>By: Aljoscha</title>
		<link>http://www.rubyfleebie.com/use-self-explicitly/#comment-851</link>
		<author>Aljoscha</author>
		<pubDate>Thu, 09 Jul 2009 15:26:46 +0000</pubDate>
		<guid>http://www.rubyfleebie.com/use-self-explicitly/#comment-851</guid>
					<description>We just got bitten by this.
Now I ask myself (and you): Isn't there a way to make Ruby emit a warning when this kind of ambiguity occurs (When there is an attribute with that name?) Such a warning could help a lot.</description>
		<content:encoded><![CDATA[<p>We just got bitten by this.<br />
Now I ask myself (and you): Isn&#8217;t there a way to make Ruby emit a warning when this kind of ambiguity occurs (When there is an attribute with that name?) Such a warning could help a lot.</p>
]]></content:encoded>
				</item>
	<item>
		<title>By: Frank</title>
		<link>http://www.rubyfleebie.com/use-self-explicitly/#comment-852</link>
		<author>Frank</author>
		<pubDate>Thu, 09 Jul 2009 18:08:11 +0000</pubDate>
		<guid>http://www.rubyfleebie.com/use-self-explicitly/#comment-852</guid>
					<description>Aljoscha,

This could be a nice to have but at the same time... it could become annoying to see warnings everytime you declare a local variable that happens to have the same name of some instance method in the class hierarchy. I think that Ruby should force us to use "self" even for attribute readers. That way people would stop getting caught by this terrible gotcha. Thanks for you comment!</description>
		<content:encoded><![CDATA[<p>Aljoscha,</p>
<p>This could be a nice to have but at the same time&#8230; it could become annoying to see warnings everytime you declare a local variable that happens to have the same name of some instance method in the class hierarchy. I think that Ruby should force us to use &#8220;self&#8221; even for attribute readers. That way people would stop getting caught by this terrible gotcha. Thanks for you comment!</p>
]]></content:encoded>
				</item>
</channel>
</rss>
