<?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: Remedial Scala: Emulating C# Extension Methods</title>
	<atom:link href="http://blog.darevay.com/2009/01/remedial-scala-emulating-c-extension-methods/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.darevay.com/2009/01/remedial-scala-emulating-c-extension-methods/</link>
	<description>You know, software and some other stuff like maybe guitar or something</description>
	<lastBuildDate>Fri, 20 Jan 2012 20:06:37 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: dave</title>
		<link>http://blog.darevay.com/2009/01/remedial-scala-emulating-c-extension-methods/comment-page-1/#comment-38</link>
		<dc:creator>dave</dc:creator>
		<pubDate>Thu, 22 Jan 2009 22:51:51 +0000</pubDate>
		<guid isPermaLink="false">http://blog.darevay.com/?p=163#comment-38</guid>
		<description>Thanks. I also enjoyed your article. For some reason the line &quot;Try to ignore the static, people!&quot; made me laugh. Anyway, as the title suggests, I&#039;m still learning Scala, but my impression is that Scala&#039;s implicit conversions, like extension methods, are bound at compile time (Scala doesn&#039;t have a static keyword). However, the conversion method may return an object of any type it wishes and the method is actually called on that returned object. I think this is why Ricky says that C#&#039;s extension methods are less flexible above. I&#039;m still learning. &lt;a href=&quot;http://blog.tmorris.net/the-power-of-type-classes-with-scala-implicit-defs/&quot; rel=&quot;nofollow&quot;&gt;This post&lt;/a&gt; seems to give an example of more powerful usage, but it&#039;s assumes a pretty good knowledge of Scala.

Thanks again for the comment.</description>
		<content:encoded><![CDATA[<p>Thanks. I also enjoyed your article. For some reason the line &#8220;Try to ignore the static, people!&#8221; made me laugh. Anyway, as the title suggests, I&#8217;m still learning Scala, but my impression is that Scala&#8217;s implicit conversions, like extension methods, are bound at compile time (Scala doesn&#8217;t have a static keyword). However, the conversion method may return an object of any type it wishes and the method is actually called on that returned object. I think this is why Ricky says that C#&#8217;s extension methods are less flexible above. I&#8217;m still learning. <a href="http://blog.tmorris.net/the-power-of-type-classes-with-scala-implicit-defs/" rel="nofollow">This post</a> seems to give an example of more powerful usage, but it&#8217;s assumes a pretty good knowledge of Scala.</p>
<p>Thanks again for the comment.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ruben Verborgh</title>
		<link>http://blog.darevay.com/2009/01/remedial-scala-emulating-c-extension-methods/comment-page-1/#comment-36</link>
		<dc:creator>Ruben Verborgh</dc:creator>
		<pubDate>Thu, 22 Jan 2009 20:15:14 +0000</pubDate>
		<guid isPermaLink="false">http://blog.darevay.com/?p=163#comment-36</guid>
		<description>Hi,

Interesting article. I just blogged about the problems associated with the static binding of extension methods. (http://ruben.3click.be/blog/extension-methods-silent-static-slaves)

I&#039;m not familiar with Scala, but the code of the stringToWords function makes it look like the binding happens at runtime, as I don&#039;t see a &quot;static&quot; keyword. Is that correct? If so, it would mean that this technique is actually a lot better then extension methods.</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>Interesting article. I just blogged about the problems associated with the static binding of extension methods. (<a href="http://ruben.3click.be/blog/extension-methods-silent-static-slaves" rel="nofollow">http://ruben.3click.be/blog/extension-methods-silent-static-slaves</a>)</p>
<p>I&#8217;m not familiar with Scala, but the code of the stringToWords function makes it look like the binding happens at runtime, as I don&#8217;t see a &#8220;static&#8221; keyword. Is that correct? If so, it would mean that this technique is actually a lot better then extension methods.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dave</title>
		<link>http://blog.darevay.com/2009/01/remedial-scala-emulating-c-extension-methods/comment-page-1/#comment-32</link>
		<dc:creator>dave</dc:creator>
		<pubDate>Wed, 21 Jan 2009 12:42:30 +0000</pubDate>
		<guid isPermaLink="false">http://blog.darevay.com/?p=163#comment-32</guid>
		<description>Thanks for the tip. I originally wrote WordCounter as a separate class, but changed it when I found this less verbose version. I wouldn&#039;t have guessed that that &quot;anonymous&quot; type would result in reflection. Do you think a case like this is an instance of a compiler that just isn&#039;t smart enough yet, or is it by design? If Scala were more widely adopted, I&#039;d really worry about performance hits like this being hidden in the concision of the language. My software is already usually really slow :)</description>
		<content:encoded><![CDATA[<p>Thanks for the tip. I originally wrote WordCounter as a separate class, but changed it when I found this less verbose version. I wouldn&#8217;t have guessed that that &#8220;anonymous&#8221; type would result in reflection. Do you think a case like this is an instance of a compiler that just isn&#8217;t smart enough yet, or is it by design? If Scala were more widely adopted, I&#8217;d really worry about performance hits like this being hidden in the concision of the language. My software is already usually really slow :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ricky Clarkson</title>
		<link>http://blog.darevay.com/2009/01/remedial-scala-emulating-c-extension-methods/comment-page-1/#comment-31</link>
		<dc:creator>Ricky Clarkson</dc:creator>
		<pubDate>Wed, 21 Jan 2009 08:27:37 +0000</pubDate>
		<guid isPermaLink="false">http://blog.darevay.com/?p=163#comment-31</guid>
		<description>Calls to wordCounts will use reflection (as that uses structural typing).  It&#039;s better to create a named type containing wordCounts:

implicit def stringToWordCounter(s: String) = WordCounter(s)
case class WordCounter(s: String) {
  def wordCounts...
}

Yes, it&#039;s more repetitive, but it&#039;s faster.  C#&#039;s extension methods have no runtime overhead, are simpler to write and much less flexible.</description>
		<content:encoded><![CDATA[<p>Calls to wordCounts will use reflection (as that uses structural typing).  It&#8217;s better to create a named type containing wordCounts:</p>
<p>implicit def stringToWordCounter(s: String) = WordCounter(s)<br />
case class WordCounter(s: String) {<br />
  def wordCounts&#8230;<br />
}</p>
<p>Yes, it&#8217;s more repetitive, but it&#8217;s faster.  C#&#8217;s extension methods have no runtime overhead, are simpler to write and much less flexible.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

