<?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:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
	>
<channel>
	<title>Comments on: Functional (Meta)?Programming Stunts for Ruby and Groovy (and a Little Perl)</title>
	<atom:link href="http://enfranchisedmind.com/blog/posts/functional-metaprogramming-ruby-groovy/feed/" rel="self" type="application/rss+xml" />
	<link>http://enfranchisedmind.com/blog/posts/functional-metaprogramming-ruby-groovy/</link>
	<description>programming, politics, &#38; other religious issues</description>
	<lastBuildDate>Sat, 28 Aug 2010 04:27:21 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>By: Robert Fischer</title>
		<link>http://enfranchisedmind.com/blog/posts/functional-metaprogramming-ruby-groovy/#comment-33429</link>
		<dc:creator>Robert Fischer</dc:creator>
		<pubDate>Thu, 26 Jun 2008 13:56:14 +0000</pubDate>
		<guid isPermaLink="false">http://enfranchisedmind.com/blog/?p=664#comment-33429</guid>
		<description>Wordie of it.  &#039;Coz why not?

&lt;a href=&quot;http://wordle.net/gallery/wrdl/33230/Enfranchised_Mind%3A_Functional_MetaProgramming_in_Ruby-Groovy&quot; rel=&quot;nofollow&quot;&gt;
&lt;img src=&quot;http://wordle.net/thumb/wrdl/33230/Enfranchised_Mind%3A_Functional_MetaProgramming_in_Ruby-Groovy&quot;&gt;
&lt;/a&gt;</description>
		<content:encoded><![CDATA[<p>Wordie of it.  &#8216;Coz why not?</p>
<p><a href="http://wordle.net/gallery/wrdl/33230/Enfranchised_Mind%3A_Functional_MetaProgramming_in_Ruby-Groovy" rel="nofollow"><br />
<img src="http://wordle.net/thumb/wrdl/33230/Enfranchised_Mind%3A_Functional_MetaProgramming_in_Ruby-Groovy"/><br />
</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: roScripts &#45; Webmaster resources and websites</title>
		<link>http://enfranchisedmind.com/blog/posts/functional-metaprogramming-ruby-groovy/#comment-33425</link>
		<dc:creator>roScripts &#45; Webmaster resources and websites</dc:creator>
		<pubDate>Thu, 26 Jun 2008 02:15:05 +0000</pubDate>
		<guid isPermaLink="false">http://enfranchisedmind.com/blog/?p=664#comment-33425</guid>
		<description>&lt;strong&gt;Functional (Meta)?Programming Stunts for Ruby and Groovy (and a Little Perl)...&lt;/strong&gt;

Functional (Meta)?Programming Stunts for Ruby and Groovy (and a Little Perl)...</description>
		<content:encoded><![CDATA[<p><strong>Functional (Meta)?Programming Stunts for Ruby and Groovy (and a Little Perl)&#8230;</strong></p>
<p>Functional (Meta)?Programming Stunts for Ruby and Groovy (and a Little Perl)&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert Fischer</title>
		<link>http://enfranchisedmind.com/blog/posts/functional-metaprogramming-ruby-groovy/#comment-33419</link>
		<dc:creator>Robert Fischer</dc:creator>
		<pubDate>Wed, 25 Jun 2008 12:56:24 +0000</pubDate>
		<guid isPermaLink="false">http://enfranchisedmind.com/blog/?p=664#comment-33419</guid>
		<description>Oh, and &lt;em&gt;flushing&lt;/em&gt; sockets/channels is something that should certainly be done deterministically: don&#039;t leave floaters in the pipe.</description>
		<content:encoded><![CDATA[<p>Oh, and <em>flushing</em> sockets/channels is something that should certainly be done deterministically: don&#8217;t leave floaters in the pipe.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert Fischer</title>
		<link>http://enfranchisedmind.com/blog/posts/functional-metaprogramming-ruby-groovy/#comment-33418</link>
		<dc:creator>Robert Fischer</dc:creator>
		<pubDate>Wed, 25 Jun 2008 12:17:32 +0000</pubDate>
		<guid isPermaLink="false">http://enfranchisedmind.com/blog/?p=664#comment-33418</guid>
		<description>Sure, there are cases when deterministic resource clean-up is important -- namely, when it&#039;s important to &lt;i&gt;know&lt;/i&gt; a resource has been cleaned up at a particular time.  Using the GC to close resources which you may want to access again in the same run is simply a bad plan.

However, there&#039;s a lot of cases where deterministic resource clean-up isn&#039;t all that important.  Take, for instance, libcurl&#039;s API, which requires global init and global clean-up to be done.  The OCaml runtime will actually do a *better* job of running the global clean-up reliably than my own code will, since it has a chance to respond to things like signals which my code doesn&#039;t address.  So what&#039;s wrong with using it there?</description>
		<content:encoded><![CDATA[<p>Sure, there are cases when deterministic resource clean-up is important &#8212; namely, when it&#8217;s important to <i>know</i> a resource has been cleaned up at a particular time.  Using the GC to close resources which you may want to access again in the same run is simply a bad plan.</p>
<p>However, there&#8217;s a lot of cases where deterministic resource clean-up isn&#8217;t all that important.  Take, for instance, libcurl&#8217;s API, which requires global init and global clean-up to be done.  The OCaml runtime will actually do a *better* job of running the global clean-up reliably than my own code will, since it has a chance to respond to things like signals which my code doesn&#8217;t address.  So what&#8217;s wrong with using it there?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Barry Kelly</title>
		<link>http://enfranchisedmind.com/blog/posts/functional-metaprogramming-ruby-groovy/#comment-33410</link>
		<dc:creator>Barry Kelly</dc:creator>
		<pubDate>Tue, 24 Jun 2008 23:56:04 +0000</pubDate>
		<guid isPermaLink="false">http://enfranchisedmind.com/blog/?p=664#comment-33410</guid>
		<description>I can&#039;t let the comment &quot;explicitly close my resources has always annoyed me&quot; go by without my own comment.

Resource ownership has semantic meaning. It&#039;s not just about memory and type safety, where GC has a good application without affecting semantic meaning - a theoretical GC with infinite memory that never freed any memory would be perfectly fine. On the other hand, closing a file handle has a concrete, observable, global effect on the system - depending on the sharing mode / OS, you can&#039;t reopen or delete an already-open file; there may be unflushed buffers in your RTL&#039;s IO code before final closing; etc. Similarly, closing a socket will be observed by the other end; and there are analogues for most OS resources that a program can acquire.

Leaving resource cleanup to a GC via finalization is in almost all cases very bad practice.

GCs aren&#039;t aware of the systemic effects of the various resources whose lifetimes you have associated with arbitrary objects, so these calculations won&#039;t enter into when it considers it opportune to perform a GC. And besides, in certain cases the GC may fail to invoke finalizers for your objects altogether.

Resources need deterministic cleanup. If you find it difficult to work out ownership semantics, consider reference counting (perhaps via a handle object) or an API protocol. For example, in C# I often use an enumeration called ResourceOwnership with two values, Preserve and Transfer. Any API that takes a resource value that has a semantic ambiguity of ownership takes a value of this enumeration type. I blogged about it some time ago (http://barrkel.blogspot.com/2006/08/specfiying-ownership.html).

Just say no to finalization. It&#039;s (almost certainly) not the answer you&#039;re looking for.</description>
		<content:encoded><![CDATA[<p>I can&#8217;t let the comment &#8220;explicitly close my resources has always annoyed me&#8221; go by without my own comment.</p>
<p>Resource ownership has semantic meaning. It&#8217;s not just about memory and type safety, where GC has a good application without affecting semantic meaning &#8211; a theoretical GC with infinite memory that never freed any memory would be perfectly fine. On the other hand, closing a file handle has a concrete, observable, global effect on the system &#8211; depending on the sharing mode / OS, you can&#8217;t reopen or delete an already-open file; there may be unflushed buffers in your RTL&#8217;s IO code before final closing; etc. Similarly, closing a socket will be observed by the other end; and there are analogues for most OS resources that a program can acquire.</p>
<p>Leaving resource cleanup to a GC via finalization is in almost all cases very bad practice.</p>
<p>GCs aren&#8217;t aware of the systemic effects of the various resources whose lifetimes you have associated with arbitrary objects, so these calculations won&#8217;t enter into when it considers it opportune to perform a GC. And besides, in certain cases the GC may fail to invoke finalizers for your objects altogether.</p>
<p>Resources need deterministic cleanup. If you find it difficult to work out ownership semantics, consider reference counting (perhaps via a handle object) or an API protocol. For example, in C# I often use an enumeration called ResourceOwnership with two values, Preserve and Transfer. Any API that takes a resource value that has a semantic ambiguity of ownership takes a value of this enumeration type. I blogged about it some time ago (<a href="http://barrkel.blogspot.com/2006/08/specfiying-ownership.html" rel="nofollow">http://barrkel.blogspot.com/2006/08/specfiying-ownership.html</a>).</p>
<p>Just say no to finalization. It&#8217;s (almost certainly) not the answer you&#8217;re looking for.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
