<?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: CodeGear, Please Fix the Anonymous Method Assymetry</title>
	<atom:link href="http://www.hans-eric.com/2009/06/03/codegear-please-fix-the-anonymous-method-assymetry/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.hans-eric.com/2009/06/03/codegear-please-fix-the-anonymous-method-assymetry/</link>
	<description>Hans-Eric Grönlund on software development</description>
	<lastBuildDate>Mon, 22 Feb 2010 09:32:51 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Method Reference Events? Nah, Not Yet.</title>
		<link>http://www.hans-eric.com/2009/06/03/codegear-please-fix-the-anonymous-method-assymetry/comment-page-1/#comment-32365</link>
		<dc:creator>Method Reference Events? Nah, Not Yet.</dc:creator>
		<pubDate>Fri, 05 Jun 2009 11:59:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.hans-eric.com/?p=135#comment-32365</guid>
		<description>[...] www.hans-eric.com Hans-Eric Grönlund on software development              &#171; CodeGear, Please Fix the Anonymous Method Assymetry [...]</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; CodeGear, Please Fix the Anonymous Method Assymetry [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hans-Eric</title>
		<link>http://www.hans-eric.com/2009/06/03/codegear-please-fix-the-anonymous-method-assymetry/comment-page-1/#comment-32313</link>
		<dc:creator>Hans-Eric</dc:creator>
		<pubDate>Thu, 04 Jun 2009 11:00:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.hans-eric.com/?p=135#comment-32313</guid>
		<description>Oh yes! I&#039;ve gotten used to the sloppy but convenient programming style that comes with a garbage collecting language and are now having a slight trouble readjusting.

I&#039;d really love to see Delphi empowered with GC, preferably like it&#039;s done in the D Programming Language: &lt;a href=&quot;http://www.hans-eric.com/2008/02/07/managing-object-lifetimes-in-d/&quot; rel=&quot;nofollow&quot;&gt;Managing Object Lifetime in D&lt;/a&gt;, with both implicit and explicit lifetime handling.</description>
		<content:encoded><![CDATA[<p>Oh yes! I&#8217;ve gotten used to the sloppy but convenient programming style that comes with a garbage collecting language and are now having a slight trouble readjusting.</p>
<p>I&#8217;d really love to see Delphi empowered with GC, preferably like it&#8217;s done in the D Programming Language: <a href="http://www.hans-eric.com/2008/02/07/managing-object-lifetimes-in-d/" rel="nofollow">Managing Object Lifetime in D</a>, with both implicit and explicit lifetime handling.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hans-Eric</title>
		<link>http://www.hans-eric.com/2009/06/03/codegear-please-fix-the-anonymous-method-assymetry/comment-page-1/#comment-32310</link>
		<dc:creator>Hans-Eric</dc:creator>
		<pubDate>Thu, 04 Jun 2009 10:48:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.hans-eric.com/?p=135#comment-32310</guid>
		<description>Thank you for taking your time to shed some light on this subject. 
The reasons seems valid enough although I&#039;m sure the issues can be addressed so that the compiler can handle all necessities behind the scene (like figuring out wether the reference needs to be GC:ed or not), possibly spawning lots of coding horrors in the code base but at least being abstract to the users of Delphi.
But then again, my experience in developing compilers and languages is - well - limited.

I wasn&#039;t aware that method references are able to hold method pointers. That fact mitigates this particular problem somewhat and I guess that&#039;ll have to be the topic of my next post.</description>
		<content:encoded><![CDATA[<p>Thank you for taking your time to shed some light on this subject.<br />
The reasons seems valid enough although I&#8217;m sure the issues can be addressed so that the compiler can handle all necessities behind the scene (like figuring out wether the reference needs to be GC:ed or not), possibly spawning lots of coding horrors in the code base but at least being abstract to the users of Delphi.<br />
But then again, my experience in developing compilers and languages is &#8211; well &#8211; limited.</p>
<p>I wasn&#8217;t aware that method references are able to hold method pointers. That fact mitigates this particular problem somewhat and I guess that&#8217;ll have to be the topic of my next post.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Barry Kelly</title>
		<link>http://www.hans-eric.com/2009/06/03/codegear-please-fix-the-anonymous-method-assymetry/comment-page-1/#comment-32281</link>
		<dc:creator>Barry Kelly</dc:creator>
		<pubDate>Wed, 03 Jun 2009 22:28:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.hans-eric.com/?p=135#comment-32281</guid>
		<description>Oh, and I forgot to mention the proper answer to all our problems: garbage collection. However, it introduces another set of problems, not least of which is the community mindset, quite apart from compatibility.</description>
		<content:encoded><![CDATA[<p>Oh, and I forgot to mention the proper answer to all our problems: garbage collection. However, it introduces another set of problems, not least of which is the community mindset, quite apart from compatibility.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Barry Kelly</title>
		<link>http://www.hans-eric.com/2009/06/03/codegear-please-fix-the-anonymous-method-assymetry/comment-page-1/#comment-32280</link>
		<dc:creator>Barry Kelly</dc:creator>
		<pubDate>Wed, 03 Jun 2009 22:26:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.hans-eric.com/?p=135#comment-32280</guid>
		<description>The reason that method pointers and method references can&#039;t be joined into a third common type is that method pointers do not require garbage collection, while method references do (and implement it via reference counting).

Method references are the union type; values of a method pointer type can be converted into a method reference type. The reverse isn&#039;t possible because of the GC issue.

The reason VCL events can&#039;t be changed to use method references is backward compatibility; far too much legacy code uses the method-cracking functionality of a cast to TMethod, or rely on method pointers being blittable values that don&#039;t require initialization or finalization, whereas managed types like strings, dynamic arrays, interface references - and method references - do.

Short note on why method references need GC: multiple anonymous methods may be written which capture state from their respective environments, and all stored into locations of a single method reference type. Method references, in other words, are polymorphic, while the implementation of captured state requires storage of variable size.

That combination of features means that the captured state storage needs to be on the heap, as unbounded variable-sized values can&#039;t be polymorphically stored in locations of a single type. That in turn means some kind of lifetime management must occur, so that the heap allocation can safely be retired when all outstanding references to the captured state, via method references, have gone out of scope.

There could be two other implementations of anonymous methods / method references which would obviate this limitation, and possibly permit method references to be stored in method pointers:

1) Prohibit variable capture by anonymous methods. This would limit their usefulness so much as to make them a questionable language addition.

2) Require manual memory management for captured state. However, since one of the raison d&#039;etre&#039;s of anonymous methods is that they permit creation of code, probably capturing locally-scoped state, in one module, and execution (via callback, essentially) from a completely independent module, the lifetime semantics are highly likely to require some kind of negotiation protocol - like, say, reference counts. Rather than develop such a protocol convention, and suggest that everyone follow it, it makes far mores sense if the compiler automates what needs to be done automatically.

So, yes, I&#039;d like to make the VCL use method references by default, but it can&#039;t happen for backward compatibility reasons. And as for a unifying type - method references are the unifying type.</description>
		<content:encoded><![CDATA[<p>The reason that method pointers and method references can&#8217;t be joined into a third common type is that method pointers do not require garbage collection, while method references do (and implement it via reference counting).</p>
<p>Method references are the union type; values of a method pointer type can be converted into a method reference type. The reverse isn&#8217;t possible because of the GC issue.</p>
<p>The reason VCL events can&#8217;t be changed to use method references is backward compatibility; far too much legacy code uses the method-cracking functionality of a cast to TMethod, or rely on method pointers being blittable values that don&#8217;t require initialization or finalization, whereas managed types like strings, dynamic arrays, interface references &#8211; and method references &#8211; do.</p>
<p>Short note on why method references need GC: multiple anonymous methods may be written which capture state from their respective environments, and all stored into locations of a single method reference type. Method references, in other words, are polymorphic, while the implementation of captured state requires storage of variable size.</p>
<p>That combination of features means that the captured state storage needs to be on the heap, as unbounded variable-sized values can&#8217;t be polymorphically stored in locations of a single type. That in turn means some kind of lifetime management must occur, so that the heap allocation can safely be retired when all outstanding references to the captured state, via method references, have gone out of scope.</p>
<p>There could be two other implementations of anonymous methods / method references which would obviate this limitation, and possibly permit method references to be stored in method pointers:</p>
<p>1) Prohibit variable capture by anonymous methods. This would limit their usefulness so much as to make them a questionable language addition.</p>
<p>2) Require manual memory management for captured state. However, since one of the raison d&#8217;etre&#8217;s of anonymous methods is that they permit creation of code, probably capturing locally-scoped state, in one module, and execution (via callback, essentially) from a completely independent module, the lifetime semantics are highly likely to require some kind of negotiation protocol &#8211; like, say, reference counts. Rather than develop such a protocol convention, and suggest that everyone follow it, it makes far mores sense if the compiler automates what needs to be done automatically.</p>
<p>So, yes, I&#8217;d like to make the VCL use method references by default, but it can&#8217;t happen for backward compatibility reasons. And as for a unifying type &#8211; method references are the unifying type.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

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