<?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/"
	xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule"
	>
<channel>
	<title>Comments on: Double-Load Guards in Ruby</title>
	<atom:link href="http://avdi.org/devblog/2009/10/22/double-load-guards-in-ruby/feed/" rel="self" type="application/rss+xml" />
	<link>http://avdi.org/devblog/2009/10/22/double-load-guards-in-ruby/</link>
	<description>"...the three great virtues of a programmer: laziness, impatience, and hubris." -- Larry Wall</description>
	<lastBuildDate>Wed, 03 Mar 2010 21:56:22 -0800</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Mike Subelsky</title>
		<link>http://avdi.org/devblog/2009/10/22/double-load-guards-in-ruby/comment-page-1/#comment-830</link>
		<dc:creator>Mike Subelsky</dc:creator>
		<pubDate>Mon, 15 Feb 2010 17:02:11 +0000</pubDate>
		<guid isPermaLink="false">http://avdi.org/devblog/?p=224#comment-830</guid>
		<description>I found the File.expand_path two-argument trick useful for writing some code that works both in Ruby 1.8 and 1.9 (where require behavior changes)</description>
		<content:encoded><![CDATA[<p>I found the File.expand_path two-argument trick useful for writing some code that works both in Ruby 1.8 and 1.9 (where require behavior changes)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike Subelsky</title>
		<link>http://avdi.org/devblog/2009/10/22/double-load-guards-in-ruby/comment-page-1/#comment-787</link>
		<dc:creator>Mike Subelsky</dc:creator>
		<pubDate>Mon, 07 Dec 2009 14:22:05 +0000</pubDate>
		<guid isPermaLink="false">http://avdi.org/devblog/?p=224#comment-787</guid>
		<description>Another awesome post Avdi!  We were having some hard-to-trace double constant definitions and using this code in my Rails pre-initializer TOTALLY surfaced them.  Thanks!</description>
		<content:encoded><![CDATA[<p>Another awesome post Avdi!  We were having some hard-to-trace double constant definitions and using this code in my Rails pre-initializer <span class="caps">TOTALLY </span>surfaced them.  Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: François Beausoleil</title>
		<link>http://avdi.org/devblog/2009/10/22/double-load-guards-in-ruby/comment-page-1/#comment-680</link>
		<dc:creator>François Beausoleil</dc:creator>
		<pubDate>Fri, 23 Oct 2009 23:19:52 +0000</pubDate>
		<guid isPermaLink="false">http://avdi.org/devblog/?p=224#comment-680</guid>
		<description>Why not use Ruby 1.9, which fixed the problem by storing the expanded path in the require table?  &lt;a href=&quot;http://eigenclass.org/hiki/Changes+in+Ruby+1.9#l25&quot; rel=&quot;nofollow&quot;&gt;http://eigenclass.org/hiki/Changes+in+Ruby+1.9#l25&lt;/a&gt;</description>
		<content:encoded><![CDATA[<p>Why not use Ruby 1.9, which fixed the problem by storing the expanded path in the require table?  <a href="http://eigenclass.org/hiki/Changes+in+Ruby+1.9#l25" rel="nofollow">http://eigenclass.org/hiki/Changes+in+Ruby+1.9#l25</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: R. Konstantin Haase</title>
		<link>http://avdi.org/devblog/2009/10/22/double-load-guards-in-ruby/comment-page-1/#comment-679</link>
		<dc:creator>R. Konstantin Haase</dc:creator>
		<pubDate>Fri, 23 Oct 2009 19:55:18 +0000</pubDate>
		<guid isPermaLink="false">http://avdi.org/devblog/?p=224#comment-679</guid>
		<description>You&#039;re right. But specs/tests is about the only place I do so myself.</description>
		<content:encoded><![CDATA[<p>You&#39;re right. But specs/tests is about the only place I do so myself.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: avdi</title>
		<link>http://avdi.org/devblog/2009/10/22/double-load-guards-in-ruby/comment-page-1/#comment-678</link>
		<dc:creator>avdi</dc:creator>
		<pubDate>Fri, 23 Oct 2009 11:55:05 +0000</pubDate>
		<guid isPermaLink="false">http://avdi.org/devblog/?p=224#comment-678</guid>
		<description>Konstantin, thanks for your comment. Setting up $LOAD_PATH is essential and I make sure to add the current project to the load path in all but the smallest of projects.&lt;br&gt;&lt;br&gt;However, there are always a few files where relative requires can&#039;t be avoided. For instance, it is conventional to set up unit test/spec files so that they can be run standalone. In order for this to work each test file has to start out by requiring a test_helper.rb or a spec_helper.rb which then sets up $LOAD_PATH, requires additional libraries, etc. Because this test helper is the first thing to be loaded and can&#039;t rely on anything else to be configured, it has to be loaded with a relative path.&lt;br&gt;&lt;br&gt;This is where I see the most double-loads occurring, because when all of the tests are run together they each require the test helper file, often with differing relative paths. Using expand_path is a way to ensure that files that must loaded relatively are required in a consistent way.&lt;br&gt;&lt;br&gt;I may update the post to make it clear that I&#039;m not suggesting you use relative requires throughout a project.</description>
		<content:encoded><![CDATA[<p>Konstantin, thanks for your comment. Setting up $LOAD_PATH is essential and I make sure to add the current project to the load path in all but the smallest of projects.</p>
<p>However, there are always a few files where relative requires can&#39;t be avoided. For instance, it is conventional to set up unit test/spec files so that they can be run standalone. In order for this to work each test file has to start out by requiring a test_helper.rb or a spec_helper.rb which then sets up $LOAD_PATH, requires additional libraries, etc. Because this test helper is the first thing to be loaded and can&#39;t rely on anything else to be configured, it has to be loaded with a relative path.</p>
<p>This is where I see the most double-loads occurring, because when all of the tests are run together they each require the test helper file, often with differing relative paths. Using expand_path is a way to ensure that files that must loaded relatively are required in a consistent way.</p>
<p>I may update the post to make it clear that I&#39;m not suggesting you use relative requires throughout a project.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: R. Konstantin Haase</title>
		<link>http://avdi.org/devblog/2009/10/22/double-load-guards-in-ruby/comment-page-1/#comment-677</link>
		<dc:creator>R. Konstantin Haase</dc:creator>
		<pubDate>Fri, 23 Oct 2009 06:05:12 +0000</pubDate>
		<guid isPermaLink="false">http://avdi.org/devblog/?p=224#comment-677</guid>
		<description>I disagree. Doing require File.expand_path is way to ugly. Just setup you $LOAD_PATH correctly and you will not encounter any of such problems. Treat your code as if it was a library.</description>
		<content:encoded><![CDATA[<p>I disagree. Doing require File.expand_path is way to ugly. Just setup you $LOAD_PATH correctly and you will not encounter any of such problems. Treat your code as if it was a library.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.400 seconds -->
