<?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: Managing Object Lifetimes in D</title>
	<atom:link href="http://www.hans-eric.com/2008/02/07/managing-object-lifetimes-in-d/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.hans-eric.com/2008/02/07/managing-object-lifetimes-in-d/</link>
	<description>Hans-Eric Grönlund on software development</description>
	<pubDate>Thu, 16 Oct 2008 04:23:46 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>By: The Functional Subset of D</title>
		<link>http://www.hans-eric.com/2008/02/07/managing-object-lifetimes-in-d/#comment-7912</link>
		<dc:creator>The Functional Subset of D</dc:creator>
		<pubDate>Tue, 20 May 2008 14:07:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.hans-eric.com/2008/02/07/managing-object-lifetimes-in-d/#comment-7912</guid>
		<description>[...] program it can not be deleted either. Like all functional languages, D features garbage collection (alongside with explicit memory management) [...]</description>
		<content:encoded><![CDATA[<p>[...] program it can not be deleted either. Like all functional languages, D features garbage collection (alongside with explicit memory management) [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: The Open-Closure-Close Idiom in D</title>
		<link>http://www.hans-eric.com/2008/02/07/managing-object-lifetimes-in-d/#comment-3519</link>
		<dc:creator>The Open-Closure-Close Idiom in D</dc:creator>
		<pubDate>Wed, 13 Feb 2008 13:22:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.hans-eric.com/2008/02/07/managing-object-lifetimes-in-d/#comment-3519</guid>
		<description>[...] www.hans-eric.com Hans-Eric Grönlund on software development              &#171; Managing Object Lifetimes in D [...]</description>
		<content:encoded><![CDATA[<p>[...] <a href="http://www.hans-eric.com" rel="nofollow">http://www.hans-eric.com</a> Hans-Eric Grönlund on software development              &laquo; Managing Object Lifetimes in D [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hans-Eric</title>
		<link>http://www.hans-eric.com/2008/02/07/managing-object-lifetimes-in-d/#comment-3372</link>
		<dc:creator>Hans-Eric</dc:creator>
		<pubDate>Sat, 09 Feb 2008 17:04:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.hans-eric.com/2008/02/07/managing-object-lifetimes-in-d/#comment-3372</guid>
		<description>Ah, that is important information. Thank you for bringing attention to it.</description>
		<content:encoded><![CDATA[<p>Ah, that is important information. Thank you for bringing attention to it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bradley Smith</title>
		<link>http://www.hans-eric.com/2008/02/07/managing-object-lifetimes-in-d/#comment-3349</link>
		<dc:creator>Bradley Smith</dc:creator>
		<pubDate>Sat, 09 Feb 2008 01:40:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.hans-eric.com/2008/02/07/managing-object-lifetimes-in-d/#comment-3349</guid>
		<description>Not only is the D garbage collector non-deterministic, but you can't reference members in the destructor. Therefore, your first example may give a runtime error because f may have be collected before the LogFile's destructor is called.

&lt;code&gt;
~this() {
  f.close;  // f should not be used
}
&lt;/code&gt;

&lt;blockquote cite="http://www.digitalmars.com/d/1.0/class.html#Destructor"&gt;

When the garbage collector calls a destructor for an object of a class that has members that are references to garbage collected objects, those references are no longer valid. This means that destructors cannot reference sub objects. This is because that the garbage collector does not collect objects in any guaranteed order, so there is no guarantee that any pointers or references to any other garbage collected objects exist when the garbage collector runs the destructor for an object. This rule does not apply to auto objects or objects deleted with the DeleteExpression, as the destructor is not being run by the garbage collector, meaning all references are valid.

The garbage collector is not guaranteed to run the destructor for all unreferenced objects. Furthermore, the order in which the garbage collector calls destructors for unreference objects is not specified.
&lt;/blockquote&gt;</description>
		<content:encoded><![CDATA[<p>Not only is the D garbage collector non-deterministic, but you can&#8217;t reference members in the destructor. Therefore, your first example may give a runtime error because f may have be collected before the LogFile&#8217;s destructor is called.</p>
<p><code><br />
~this() {<br />
  f.close;  // f should not be used<br />
}<br />
</code></p>
<blockquote cite="http://www.digitalmars.com/d/1.0/class.html#Destructor">
<p>When the garbage collector calls a destructor for an object of a class that has members that are references to garbage collected objects, those references are no longer valid. This means that destructors cannot reference sub objects. This is because that the garbage collector does not collect objects in any guaranteed order, so there is no guarantee that any pointers or references to any other garbage collected objects exist when the garbage collector runs the destructor for an object. This rule does not apply to auto objects or objects deleted with the DeleteExpression, as the destructor is not being run by the garbage collector, meaning all references are valid.</p>
<p>The garbage collector is not guaranteed to run the destructor for all unreferenced objects. Furthermore, the order in which the garbage collector calls destructors for unreference objects is not specified.
</p></blockquote>
]]></content:encoded>
	</item>
	<item>
		<title>By: Javi</title>
		<link>http://www.hans-eric.com/2008/02/07/managing-object-lifetimes-in-d/#comment-3331</link>
		<dc:creator>Javi</dc:creator>
		<pubDate>Fri, 08 Feb 2008 12:51:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.hans-eric.com/2008/02/07/managing-object-lifetimes-in-d/#comment-3331</guid>
		<description>Ohhh! What a constructive comment! Bravo! 
And how do you know that I don't use them???
Relax a bit and enjoy life man :-)</description>
		<content:encoded><![CDATA[<p>Ohhh! What a constructive comment! Bravo!<br />
And how do you know that I don&#8217;t use them???<br />
Relax a bit and enjoy life man <img src='http://www.hans-eric.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hans-Eric</title>
		<link>http://www.hans-eric.com/2008/02/07/managing-object-lifetimes-in-d/#comment-3325</link>
		<dc:creator>Hans-Eric</dc:creator>
		<pubDate>Fri, 08 Feb 2008 11:50:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.hans-eric.com/2008/02/07/managing-object-lifetimes-in-d/#comment-3325</guid>
		<description>Thank you for your nice comment. I too am "trying to pick up the language". 
I'll keep an eye on your blog as well, especially the low-level stuff, something I haven't done too much myself.</description>
		<content:encoded><![CDATA[<p>Thank you for your nice comment. I too am &#8220;trying to pick up the language&#8221;.<br />
I&#8217;ll keep an eye on your blog as well, especially the low-level stuff, something I haven&#8217;t done too much myself.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Panio Donev</title>
		<link>http://www.hans-eric.com/2008/02/07/managing-object-lifetimes-in-d/#comment-3324</link>
		<dc:creator>Panio Donev</dc:creator>
		<pubDate>Fri, 08 Feb 2008 11:35:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.hans-eric.com/2008/02/07/managing-object-lifetimes-in-d/#comment-3324</guid>
		<description>Man you are dumb. If you don't trust the garbage collector, then use C or C++ like everybody else.</description>
		<content:encoded><![CDATA[<p>Man you are dumb. If you don&#8217;t trust the garbage collector, then use C or C++ like everybody else.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hans-Eric</title>
		<link>http://www.hans-eric.com/2008/02/07/managing-object-lifetimes-in-d/#comment-3323</link>
		<dc:creator>Hans-Eric</dc:creator>
		<pubDate>Fri, 08 Feb 2008 11:34:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.hans-eric.com/2008/02/07/managing-object-lifetimes-in-d/#comment-3323</guid>
		<description>Well, I've come to realize that I don't really need a deterministic destruction of objects very often. But when I do need it, the D solution to support both implicit and explicit destruction is really convenient.

Good thing you pointed out scope classes. They are great if you need to make sure the object never escapes the scope it was created in.</description>
		<content:encoded><![CDATA[<p>Well, I&#8217;ve come to realize that I don&#8217;t really need a deterministic destruction of objects very often. But when I do need it, the D solution to support both implicit and explicit destruction is really convenient.</p>
<p>Good thing you pointed out scope classes. They are great if you need to make sure the object never escapes the scope it was created in.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hans-Eric</title>
		<link>http://www.hans-eric.com/2008/02/07/managing-object-lifetimes-in-d/#comment-3322</link>
		<dc:creator>Hans-Eric</dc:creator>
		<pubDate>Fri, 08 Feb 2008 11:29:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.hans-eric.com/2008/02/07/managing-object-lifetimes-in-d/#comment-3322</guid>
		<description>Can't argue with this one :-)</description>
		<content:encoded><![CDATA[<p>Can&#8217;t argue with this one <img src='http://www.hans-eric.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: komma8.komma1</title>
		<link>http://www.hans-eric.com/2008/02/07/managing-object-lifetimes-in-d/#comment-3305</link>
		<dc:creator>komma8.komma1</dc:creator>
		<pubDate>Fri, 08 Feb 2008 01:29:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.hans-eric.com/2008/02/07/managing-object-lifetimes-in-d/#comment-3305</guid>
		<description>Thanks for your help - that clarifies things a bit. It's going to take me a while to get good at memory management again (still not nearly as bad as C++). I was a C guy back in school, but I've been doing C#, Java, Perl, and TCL at work for the past 8 years! It's nice to get back to lower level programming - I'm having a lot of fun with D.</description>
		<content:encoded><![CDATA[<p>Thanks for your help - that clarifies things a bit. It&#8217;s going to take me a while to get good at memory management again (still not nearly as bad as C++). I was a C guy back in school, but I&#8217;ve been doing C#, Java, Perl, and TCL at work for the past 8 years! It&#8217;s nice to get back to lower level programming - I&#8217;m having a lot of fun with D.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

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