<?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: Understanding Anonymous Methods</title>
	<atom:link href="http://blogs.teamb.com/craigstuntz/2008/08/04/37828/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.teamb.com/craigstuntz/2008/08/04/37828/</link>
	<description>C# • Delphi • Entity Framework • Functional Programming • InterBase • MVC • .NET • Web</description>
	<pubDate>Tue, 16 Mar 2010 22:42:45 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.2</generator>
		<item>
		<title>By: Nick Hodges &#187; Blog Archive &#187; Tiburon News, Information, and Sneak Peeks</title>
		<link>http://blogs.teamb.com/craigstuntz/2008/08/04/37828/#comment-3734</link>
		<dc:creator>Nick Hodges &#187; Blog Archive &#187; Tiburon News, Information, and Sneak Peeks</dc:creator>
		<pubDate>Fri, 08 Aug 2008 15:31:48 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.teamb.com/craigstuntz/2008/08/04/37828#comment-3734</guid>
		<description>[...] Craig Stuntz is talking about Generics and Anonymous Methods. [...]</description>
		<content:encoded><![CDATA[<p>[...] Craig Stuntz is talking about Generics and Anonymous Methods. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Craig Stuntz</title>
		<link>http://blogs.teamb.com/craigstuntz/2008/08/04/37828/#comment-3726</link>
		<dc:creator>Craig Stuntz</dc:creator>
		<pubDate>Tue, 05 Aug 2008 15:17:22 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.teamb.com/craigstuntz/2008/08/04/37828#comment-3726</guid>
		<description>Lars,

One place to look for examples of using anonymous methods is JavaScript code.  It seems to be a very common idiom there, particularly because JavaScript is, by its very nature, very much asynchronous and therefore dependent on callbacks.  You can think of JavaScript, loosely, as based on a continuation passing style, rather than on a stack. It's quite common to have trivial callbacks which will only ever be used in one place, although they might be added to many different selectors.  In such cases, it makes sense to put these callbacks inline in the expression which assigns them, rather than elsewhere in your code.

With regards to your blog comments on anonymous methods and lambda expressions, anonymous methods could be seen as a "first step" towards lambda expressions.  In a statically-type environment, lambda expressions typically have type inferencing, whereas anonymous methods, both in Delphi and C#, do not.  Also, a "lambda," per se, most properly should be purely functional, although C# does not enforce this.

As for IntToStr, you're right, it isn't necessary.  I originally wrote the code with ShowMessage, where it is required, and later changed it to WriteLn when I realized that I should show the "output."</description>
		<content:encoded><![CDATA[<p>Lars,</p>
<p>One place to look for examples of using anonymous methods is JavaScript code.  It seems to be a very common idiom there, particularly because JavaScript is, by its very nature, very much asynchronous and therefore dependent on callbacks.  You can think of JavaScript, loosely, as based on a continuation passing style, rather than on a stack. It&#8217;s quite common to have trivial callbacks which will only ever be used in one place, although they might be added to many different selectors.  In such cases, it makes sense to put these callbacks inline in the expression which assigns them, rather than elsewhere in your code.</p>
<p>With regards to your blog comments on anonymous methods and lambda expressions, anonymous methods could be seen as a "first step" towards lambda expressions.  In a statically-type environment, lambda expressions typically have type inferencing, whereas anonymous methods, both in Delphi and C#, do not.  Also, a "lambda," per se, most properly should be purely functional, although C# does not enforce this.</p>
<p>As for IntToStr, you&#8217;re right, it isn&#8217;t necessary.  I originally wrote the code with ShowMessage, where it is required, and later changed it to WriteLn when I realized that I should show the "output."</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lars Fosdal</title>
		<link>http://blogs.teamb.com/craigstuntz/2008/08/04/37828/#comment-3725</link>
		<dc:creator>Lars Fosdal</dc:creator>
		<pubDate>Tue, 05 Aug 2008 14:36:11 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.teamb.com/craigstuntz/2008/08/04/37828#comment-3725</guid>
		<description>I suspect that one of the reasons for so many having problems with realizing the impact of anon.methods, is that all the examples so far have been trivial code that can be done without anon.methods.  

As soon as we start using generics, the benefits are much more clear (TCollection.ForEach f.x.), but even those can be done using sub-classing and without anon.methods.  

The discussion then appear to derail over in which style (inline declared anon methods, or object protected virtual methods) that is preferable.

I made some speculations on when they could be used 
http://delphi.fosdal.com/2008/08/anonymous-methods-when-to-use-them.html

but we could use something more elaborate and thought through which really shows off the power of anon.methods.

P.S. Why did you add IntToStr(i) inside the WriteLn? :)</description>
		<content:encoded><![CDATA[<p>I suspect that one of the reasons for so many having problems with realizing the impact of anon.methods, is that all the examples so far have been trivial code that can be done without anon.methods.  </p>
<p>As soon as we start using generics, the benefits are much more clear (TCollection.ForEach f.x.), but even those can be done using sub-classing and without anon.methods.  </p>
<p>The discussion then appear to derail over in which style (inline declared anon methods, or object protected virtual methods) that is preferable.</p>
<p>I made some speculations on when they could be used<br />
<a href="http://delphi.fosdal.com/2008/08/anonymous-methods-when-to-use-them.html" rel="nofollow">http://delphi.fosdal.com/2008/08/anonymous-methods-when-to-use-them.html</a></p>
<p>but we could use something more elaborate and thought through which really shows off the power of anon.methods.</p>
<p>P.S. Why did you add IntToStr(i) inside the WriteLn? <img src='http://blogs.teamb.com/craigstuntz/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Craig Stuntz</title>
		<link>http://blogs.teamb.com/craigstuntz/2008/08/04/37828/#comment-3723</link>
		<dc:creator>Craig Stuntz</dc:creator>
		<pubDate>Tue, 05 Aug 2008 00:57:48 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.teamb.com/craigstuntz/2008/08/04/37828#comment-3723</guid>
		<description>Bart Roozendaal has a dissenting view (maybe):

http://blogs.sevensteps.com/2008/08/i-now-get-anonymous-methods-but-i.html

I don't agree with Bart's post, (though it seems from later comments like he's starting to get it) but he's entitled to his opinion. I'm linking it here since he mentions this post.</description>
		<content:encoded><![CDATA[<p>Bart Roozendaal has a dissenting view (maybe):</p>
<p><a href="http://blogs.sevensteps.com/2008/08/i-now-get-anonymous-methods-but-i.html" rel="nofollow">http://blogs.sevensteps.com/2008/08/i-now-get-anonymous-methods-but-i.html</a></p>
<p>I don&#8217;t agree with Bart&#8217;s post, (though it seems from later comments like he&#8217;s starting to get it) but he&#8217;s entitled to his opinion. I&#8217;m linking it here since he mentions this post.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: El Cy</title>
		<link>http://blogs.teamb.com/craigstuntz/2008/08/04/37828/#comment-3720</link>
		<dc:creator>El Cy</dc:creator>
		<pubDate>Mon, 04 Aug 2008 20:08:08 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.teamb.com/craigstuntz/2008/08/04/37828#comment-3720</guid>
		<description>An interesting read in this context ....

The Evolution Of LINQ And Its Impact On The Design Of C#
http://msdn.microsoft.com/en-us/magazine/cc163400.aspx</description>
		<content:encoded><![CDATA[<p>An interesting read in this context &#8230;.</p>
<p>The Evolution Of LINQ And Its Impact On The Design Of C#<br />
<a href="http://msdn.microsoft.com/en-us/magazine/cc163400.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/magazine/cc163400.aspx</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Craig Stuntz</title>
		<link>http://blogs.teamb.com/craigstuntz/2008/08/04/37828/#comment-3719</link>
		<dc:creator>Craig Stuntz</dc:creator>
		<pubDate>Mon, 04 Aug 2008 16:50:38 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.teamb.com/craigstuntz/2008/08/04/37828#comment-3719</guid>
		<description>Yes, Erik, I agree.</description>
		<content:encoded><![CDATA[<p>Yes, Erik, I agree.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Erik</title>
		<link>http://blogs.teamb.com/craigstuntz/2008/08/04/37828/#comment-3718</link>
		<dc:creator>Erik</dc:creator>
		<pubDate>Mon, 04 Aug 2008 16:34:14 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.teamb.com/craigstuntz/2008/08/04/37828#comment-3718</guid>
		<description>I think that some of the confusion is caused by a literal interpretation of the name of this feature.  The critical benefits of "Anonymous Methods" have less to do with them not being named.  If you were able to assign names to them (which is similar to what you do when when you assign them to a variable named with a given identifier), their critical features would still be in place.  You mainly limit the calling scope to those that have access to the declaration location or any variable that holds a reference to the anon method, and provide the features such as variable capture.  I wonder if the Delphi implementation is automatically thread-safe with respect to writing to the local variables in multiple threads, etc., or if some language features would be made available to easily control access to those variables...</description>
		<content:encoded><![CDATA[<p>I think that some of the confusion is caused by a literal interpretation of the name of this feature.  The critical benefits of "Anonymous Methods" have less to do with them not being named.  If you were able to assign names to them (which is similar to what you do when when you assign them to a variable named with a given identifier), their critical features would still be in place.  You mainly limit the calling scope to those that have access to the declaration location or any variable that holds a reference to the anon method, and provide the features such as variable capture.  I wonder if the Delphi implementation is automatically thread-safe with respect to writing to the local variables in multiple threads, etc., or if some language features would be made available to easily control access to those variables&#8230;</p>
]]></content:encoded>
	</item>
</channel>
</rss>
