<?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:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments for Matt Malone's Old-Fashioned Software Development Blog</title>
	<atom:link href="http://oldfashionedsoftware.com/comments/feed/" rel="self" type="application/rss+xml" />
	<link>http://oldfashionedsoftware.com</link>
	<description></description>
	<lastBuildDate>Wed, 25 Jan 2012 15:21:25 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>Comment on Lots And Lots Of foldLeft Examples by Jacek</title>
		<link>http://oldfashionedsoftware.com/2009/07/30/lots-and-lots-of-foldleft-examples/#comment-728</link>
		<dc:creator><![CDATA[Jacek]]></dc:creator>
		<pubDate>Wed, 25 Jan 2012 15:21:25 +0000</pubDate>
		<guid isPermaLink="false">http://oldfashionedsoftware.com/?p=316#comment-728</guid>
		<description><![CDATA[Thanks for this great post! It provided a great way to get my hands dirty with the &quot;foldLeft&quot; way of thinking - which was a nice brain teaser and helped me understand the ideas behind (e.g. the recursive definition of lists in Scala).

Now I&#039;m continuing to the rest of your Scala posts :)]]></description>
		<content:encoded><![CDATA[<p>Thanks for this great post! It provided a great way to get my hands dirty with the &#8220;foldLeft&#8221; way of thinking &#8211; which was a nice brain teaser and helped me understand the ideas behind (e.g. the recursive definition of lists in Scala).</p>
<p>Now I&#8217;m continuing to the rest of your Scala posts :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Variance Basics in Java and Scala by Santiago Basulto</title>
		<link>http://oldfashionedsoftware.com/2008/08/26/variance-basics-in-java-and-scala/#comment-727</link>
		<dc:creator><![CDATA[Santiago Basulto]]></dc:creator>
		<pubDate>Mon, 09 Jan 2012 14:22:32 +0000</pubDate>
		<guid isPermaLink="false">http://matthewmalone.wordpress.com/?p=118#comment-727</guid>
		<description><![CDATA[Great post brother. Thanks a lot!]]></description>
		<content:encoded><![CDATA[<p>Great post brother. Thanks a lot!</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on String Distance and Refactoring in Scala by Authentication and Permissions</title>
		<link>http://oldfashionedsoftware.com/2009/11/19/string-distance-and-refactoring-in-scala/#comment-725</link>
		<dc:creator><![CDATA[Authentication and Permissions]]></dc:creator>
		<pubDate>Wed, 14 Dec 2011 16:58:36 +0000</pubDate>
		<guid isPermaLink="false">http://oldfashionedsoftware.com/?p=382#comment-725</guid>
		<description><![CDATA[i think you are going in right way for your task. And it&#039;s real method of string and code is ok to implement.]]></description>
		<content:encoded><![CDATA[<p>i think you are going in right way for your task. And it&#8217;s real method of string and code is ok to implement.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Self Help by cayhorstmann</title>
		<link>http://oldfashionedsoftware.com/2009/12/10/self-help/#comment-718</link>
		<dc:creator><![CDATA[cayhorstmann]]></dc:creator>
		<pubDate>Sun, 11 Sep 2011 13:43:49 +0000</pubDate>
		<guid isPermaLink="false">http://oldfashionedsoftware.com/?p=434#comment-718</guid>
		<description><![CDATA[Why would anyone have Mass extend Dimension[Time] and have its create method return a new Time? But I see your point--with your setup, that is checked by the compiler. Very nice.

You were wondering why Ordered doesn&#039;t use your trick. That&#039;s because it is sometimes the case that a class T extends Ordered[U], where U is a superclass. For example,

class Person(val id: Short) extends Ordered[Person] {
  def compare(other: Person) = id.toInt - other.id 
}

Now consider 

class Student(val major: String, id: Short) extends Person(id) 

You couldn&#039;t have Student be a subtype of Ordered[Student].]]></description>
		<content:encoded><![CDATA[<p>Why would anyone have Mass extend Dimension[Time] and have its create method return a new Time? But I see your point&#8211;with your setup, that is checked by the compiler. Very nice.</p>
<p>You were wondering why Ordered doesn&#8217;t use your trick. That&#8217;s because it is sometimes the case that a class T extends Ordered[U], where U is a superclass. For example,</p>
<p>class Person(val id: Short) extends Ordered[Person] {<br />
  def compare(other: Person) = id.toInt &#8211; other.id<br />
}</p>
<p>Now consider </p>
<p>class Student(val major: String, id: Short) extends Person(id) </p>
<p>You couldn&#8217;t have Student be a subtype of Ordered[Student].</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Self Help by Matt</title>
		<link>http://oldfashionedsoftware.com/2009/12/10/self-help/#comment-717</link>
		<dc:creator><![CDATA[Matt]]></dc:creator>
		<pubDate>Tue, 06 Sep 2011 14:51:03 +0000</pubDate>
		<guid isPermaLink="false">http://oldfashionedsoftware.com/?p=434#comment-717</guid>
		<description><![CDATA[This type bound still allows me to create a type that is added and subtracted with something other than its own kind.

scala&gt; abstract class Dimension[T &lt;: Dimension[T]](val value: Double, val name: String, val coef: Double) {
  protected def create(value: Double, name: String, coef: Double): T
  def +(x: Dimension[T]): T = create(value + coef * x.value / x.coef, name, coef)
  def -(x: Dimension[T]): T = create(value - coef * x.value / x.coef, name, coef)
  override def toString(): String = value + &quot; &quot; + name
}

 class Time(value: Double, name: String, coef: Double) extends
     &#124;       Dimension[Time](value, name, coef) {
     &#124;   protected def create(a: Double, b: String, c: Double) = new Time(a, b, c)
     &#124; }
defined class Time

scala&gt; class Mass(value: Double, name: String, coef: Double) extends
     &#124;       Dimension[Time](value, name, coef) {
     &#124;   protected def create(a: Double, b: String, c: Double) = new Time(a, b, c)
     &#124; }
defined class Mass

That compiles.  Scala doesn&#039;t mind that Time and Mass are two different things because they both descend from Dimension.  What I was trying to achieve in this code is an abstract class whose descendents can only be added and subtracted with themselves.  Mass can only be added to mass, and never to Time.

The type bound only allows us to restrict based on which types descend from some known type.  A self type provides an object with a handle specifically to its own type, and provides its descendents with a handle to their own types.  Using the above code using type bounds, we could do the following:

scala&gt; abstract class TimeUnit(name: String, coef: Double) {
     &#124;   def apply(value: Double) = new Time(value, name, coef)
     &#124;   def apply(orig: Time) = new Time(0, name, coef) + orig
     &#124; }
defined class TimeUnit

scala&gt; abstract class MassUnit(name: String, coef: Double) {
     &#124;   def apply(value: Double) = new Mass(value, name, coef)
     &#124;   def apply(orig: Time) = new Mass(0, name, coef) + orig
     &#124; }
defined class MassUnit

scala&gt; object Second   extends TimeUnit(&quot;seconds&quot;,    1.0)
defined module Second

scala&gt; object Kilogram extends MassUnit(&quot;kg&quot;,         1.0)
defined module Kilogram

scala&gt; Second(1.0) + Kilogram(1.0)
res0: Time = 2.0 seconds

scala&gt; Kilogram(1.0) + Second(1.0)
res1: Time = 2.0 kg]]></description>
		<content:encoded><![CDATA[<p>This type bound still allows me to create a type that is added and subtracted with something other than its own kind.</p>
<p>scala&gt; abstract class Dimension[T &lt;: Dimension[T]](val value: Double, val name: String, val coef: Double) {<br />
  protected def create(value: Double, name: String, coef: Double): T<br />
  def +(x: Dimension[T]): T = create(value + coef * x.value / x.coef, name, coef)<br />
  def -(x: Dimension[T]): T = create(value &#8211; coef * x.value / x.coef, name, coef)<br />
  override def toString(): String = value + &#8221; &#8221; + name<br />
}</p>
<p> class Time(value: Double, name: String, coef: Double) extends<br />
     |       Dimension[Time](value, name, coef) {<br />
     |   protected def create(a: Double, b: String, c: Double) = new Time(a, b, c)<br />
     | }<br />
defined class Time</p>
<p>scala&gt; class Mass(value: Double, name: String, coef: Double) extends<br />
     |       Dimension[Time](value, name, coef) {<br />
     |   protected def create(a: Double, b: String, c: Double) = new Time(a, b, c)<br />
     | }<br />
defined class Mass</p>
<p>That compiles.  Scala doesn&#8217;t mind that Time and Mass are two different things because they both descend from Dimension.  What I was trying to achieve in this code is an abstract class whose descendents can only be added and subtracted with themselves.  Mass can only be added to mass, and never to Time.</p>
<p>The type bound only allows us to restrict based on which types descend from some known type.  A self type provides an object with a handle specifically to its own type, and provides its descendents with a handle to their own types.  Using the above code using type bounds, we could do the following:</p>
<p>scala&gt; abstract class TimeUnit(name: String, coef: Double) {<br />
     |   def apply(value: Double) = new Time(value, name, coef)<br />
     |   def apply(orig: Time) = new Time(0, name, coef) + orig<br />
     | }<br />
defined class TimeUnit</p>
<p>scala&gt; abstract class MassUnit(name: String, coef: Double) {<br />
     |   def apply(value: Double) = new Mass(value, name, coef)<br />
     |   def apply(orig: Time) = new Mass(0, name, coef) + orig<br />
     | }<br />
defined class MassUnit</p>
<p>scala&gt; object Second   extends TimeUnit(&#8220;seconds&#8221;,    1.0)<br />
defined module Second</p>
<p>scala&gt; object Kilogram extends MassUnit(&#8220;kg&#8221;,         1.0)<br />
defined module Kilogram</p>
<p>scala&gt; Second(1.0) + Kilogram(1.0)<br />
res0: Time = 2.0 seconds</p>
<p>scala&gt; Kilogram(1.0) + Second(1.0)<br />
res1: Time = 2.0 kg</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Self Help by cayhorstmann</title>
		<link>http://oldfashionedsoftware.com/2009/12/10/self-help/#comment-716</link>
		<dc:creator><![CDATA[cayhorstmann]]></dc:creator>
		<pubDate>Tue, 06 Sep 2011 02:28:41 +0000</pubDate>
		<guid isPermaLink="false">http://oldfashionedsoftware.com/?p=434#comment-716</guid>
		<description><![CDATA[You can avoid the self type (which is maybe one of the more mysterious constructs in Scala) by using a type bound

abstract class Dimension[T &lt;: Dimension[T]]

Maybe that&#039;s equally mysterious :-)]]></description>
		<content:encoded><![CDATA[<p>You can avoid the self type (which is maybe one of the more mysterious constructs in Scala) by using a type bound</p>
<p>abstract class Dimension[T &lt;: Dimension[T]]</p>
<p>Maybe that&#039;s equally mysterious :-)</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Scala Code Review: foldLeft and foldRight by Matt</title>
		<link>http://oldfashionedsoftware.com/2009/07/10/scala-code-review-foldleft-and-foldright/#comment-715</link>
		<dc:creator><![CDATA[Matt]]></dc:creator>
		<pubDate>Thu, 01 Sep 2011 22:34:23 +0000</pubDate>
		<guid isPermaLink="false">http://oldfashionedsoftware.com/?p=239#comment-715</guid>
		<description><![CDATA[Thanks Christopher. Those look like good alternatives to a plain List.]]></description>
		<content:encoded><![CDATA[<p>Thanks Christopher. Those look like good alternatives to a plain List.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Scala Code Review: foldLeft and foldRight by Christopher Currie</title>
		<link>http://oldfashionedsoftware.com/2009/07/10/scala-code-review-foldleft-and-foldright/#comment-714</link>
		<dc:creator><![CDATA[Christopher Currie]]></dc:creator>
		<pubDate>Wed, 31 Aug 2011 19:22:29 +0000</pubDate>
		<guid isPermaLink="false">http://oldfashionedsoftware.com/?p=239#comment-714</guid>
		<description><![CDATA[For future readers, this post was written just before Scala 2.8 was released. in 2.8+, non-strict collections are your friends:

scala&gt; 1 to 325000
res0: scala.collection.immutable.Range.Inclusive = Range(1, 2, 3...
scala&gt; res0.foldRight(&quot;&quot;)((x,y)=&gt;&quot;X&quot;)
res1: java.lang.String = X

scala&gt; res0.toList.view
res2: java.lang.Object with scala.collection.SeqView[Int,List[Int]] = SeqView(...)

scala&gt; res2.foldRight(&quot;&quot;)((x,y)=&gt;&quot;X&quot;)
res3: java.lang.String = X]]></description>
		<content:encoded><![CDATA[<p>For future readers, this post was written just before Scala 2.8 was released. in 2.8+, non-strict collections are your friends:</p>
<p>scala&gt; 1 to 325000<br />
res0: scala.collection.immutable.Range.Inclusive = Range(1, 2, 3&#8230;<br />
scala&gt; res0.foldRight(&#8220;&#8221;)((x,y)=&gt;&#8221;X&#8221;)<br />
res1: java.lang.String = X</p>
<p>scala&gt; res0.toList.view<br />
res2: java.lang.Object with scala.collection.SeqView[Int,List[Int]] = SeqView(&#8230;)</p>
<p>scala&gt; res2.foldRight(&#8220;&#8221;)((x,y)=&gt;&#8221;X&#8221;)<br />
res3: java.lang.String = X</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Lots And Lots Of foldLeft Examples by Matt</title>
		<link>http://oldfashionedsoftware.com/2009/07/30/lots-and-lots-of-foldleft-examples/#comment-713</link>
		<dc:creator><![CDATA[Matt]]></dc:creator>
		<pubDate>Wed, 31 Aug 2011 14:38:16 +0000</pubDate>
		<guid isPermaLink="false">http://oldfashionedsoftware.com/?p=316#comment-713</guid>
		<description><![CDATA[That&#039;s very kind of you, Kai.  I&#039;m glad you&#039;ve enjoyed my posts.  I&#039;ve been meaning to write some new ones, and it&#039;s good motivation to know that people are reading them.]]></description>
		<content:encoded><![CDATA[<p>That&#8217;s very kind of you, Kai.  I&#8217;m glad you&#8217;ve enjoyed my posts.  I&#8217;ve been meaning to write some new ones, and it&#8217;s good motivation to know that people are reading them.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Lots And Lots Of foldLeft Examples by Kai Wähner</title>
		<link>http://oldfashionedsoftware.com/2009/07/30/lots-and-lots-of-foldleft-examples/#comment-712</link>
		<dc:creator><![CDATA[Kai Wähner]]></dc:creator>
		<pubDate>Wed, 31 Aug 2011 12:25:40 +0000</pubDate>
		<guid isPermaLink="false">http://oldfashionedsoftware.com/?p=316#comment-712</guid>
		<description><![CDATA[Hey Matt,

congratulations for your Scala blogs. I found this one using Google. It forwarded me to your foldLeft explanation. That one forwarded me to your Tail-Recursion basics. While reading them, Google forwarded me to your &quot;Null, null, Nil, ...&quot; blog.

These blogs are very good, because they are natural and easy to understand! The main problem of Scala is the lack of good, easy to ready blogs and books, still. Odersky and some others wrote books with good contents, but these books are only good as reference book, because they are to difficult to understand IMO.

Best regards,
Kai Wähner (Twitter: @KaiWaehner)]]></description>
		<content:encoded><![CDATA[<p>Hey Matt,</p>
<p>congratulations for your Scala blogs. I found this one using Google. It forwarded me to your foldLeft explanation. That one forwarded me to your Tail-Recursion basics. While reading them, Google forwarded me to your &#8220;Null, null, Nil, &#8230;&#8221; blog.</p>
<p>These blogs are very good, because they are natural and easy to understand! The main problem of Scala is the lack of good, easy to ready blogs and books, still. Odersky and some others wrote books with good contents, but these books are only good as reference book, because they are to difficult to understand IMO.</p>
<p>Best regards,<br />
Kai Wähner (Twitter: @KaiWaehner)</p>
]]></content:encoded>
	</item>
</channel>
</rss>

