<?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: Modules in Scala</title>
	<atom:link href="http://existentialtype.net/2008/05/26/modules-in-scala/feed/" rel="self" type="application/rss+xml" />
	<link>http://existentialtype.net/2008/05/26/modules-in-scala/</link>
	<description>For People Who Like Type and Types</description>
	<pubDate>Tue, 06 Jan 2009 11:06:59 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: ∃xistential Type &#187; Even more modules in Scala</title>
		<link>http://existentialtype.net/2008/05/26/modules-in-scala/comment-page-1/#comment-22807</link>
		<dc:creator>∃xistential Type &#187; Even more modules in Scala</dc:creator>
		<pubDate>Mon, 26 May 2008 21:29:32 +0000</pubDate>
		<guid isPermaLink="false">http://existentialtype.net/?p=245#comment-22807</guid>
		<description>[...] using N.f on N.a.x is even well-typed, but still encounters the same problems with evaluation I mentioned earlier. And yes, the type N.a.T is [...]</description>
		<content:encoded><![CDATA[<p>[...] using N.f on N.a.x is even well-typed, but still encounters the same problems with evaluation I mentioned earlier. And yes, the type N.a.T is [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: washburn</title>
		<link>http://existentialtype.net/2008/05/26/modules-in-scala/comment-page-1/#comment-22806</link>
		<dc:creator>washburn</dc:creator>
		<pubDate>Mon, 26 May 2008 21:08:07 +0000</pubDate>
		<guid isPermaLink="false">http://existentialtype.net/?p=245#comment-22806</guid>
		<description>@James:  Indeed, I think that the restriction to class types could be relaxed a little.  Certainly it is not problem for Featherweight Scala, but there may be subtle issues trying to compile some of these things for the JVM.  

As another example, it would be nice to be able to "premix" traits that are commonly used together without creating a new trait:
&lt;pre lang="scala"&gt;
type AB = A with B
new AB { } // doesn't work
&lt;/pre&gt;
Instead of having to always expand it out everywhere.  Furthermore, it is just strange that &lt;code&gt;with&lt;/code&gt; does not associate:
&lt;pre lang="scala"&gt;
new A with B with C { } // okay
new A with (B with C) { } // doesn't work
new (A with B) with C { } // doesn't work
new (A with B) { } // doesn't work
&lt;/pre&gt;
I think Martin has said he would at least commit to fixing the associativity issue, but we'll see whether it can be relaxed further.</description>
		<content:encoded><![CDATA[<p>@James:  Indeed, I think that the restriction to class types could be relaxed a little.  Certainly it is not problem for Featherweight Scala, but there may be subtle issues trying to compile some of these things for the JVM.  </p>
<p>As another example, it would be nice to be able to &#8220;premix&#8221; traits that are commonly used together without creating a new trait:</p>
<pre lang="scala">
type AB = A with B
new AB { } // doesn't work
</pre>
<p>Instead of having to always expand it out everywhere.  Furthermore, it is just strange that <code>with</code> does not associate:</p>
<pre lang="scala">
new A with B with C { } // okay
new A with (B with C) { } // doesn't work
new (A with B) with C { } // doesn't work
new (A with B) { } // doesn't work
</pre>
<p>I think Martin has said he would at least commit to fixing the associativity issue, but we&#8217;ll see whether it can be relaxed further.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: James Iry</title>
		<link>http://existentialtype.net/2008/05/26/modules-in-scala/comment-page-1/#comment-22805</link>
		<dc:creator>James Iry</dc:creator>
		<pubDate>Mon, 26 May 2008 20:48:01 +0000</pubDate>
		<guid isPermaLink="false">http://existentialtype.net/?p=245#comment-22805</guid>
		<description>As I thought about it, I became curious why there's a problem with "object MyNat extends Nat {...".  It seems pretty clear that I would just be asking the type checker to verify that MyNat is compatible with the Nat type at the point that MyNat is defined.  Even with abstract classes the compiler could just quietly create a trait/interface for Nat and use the standard mechanisms for ensuring that instantiable subclasses/objects implement that trait.

e.g. (this is obviously silly, but...)
type Nat = {...}

abstract class MyPartialNat extends Nat {
   type T = int
   val z = 0
}

object MyNat extends MyPartialNat {
   def s(arg:Int) = arg + 1
}

object MyWeirdNat extends MyPartialNat {
   def s(arg:Int) = arg - 1
}

could translate into

type Nat {...}

trait Nat$Trait {...} // compiler generated trait

abstract class MyParitalNat extends AnyRef with Nat$Trait {
...</description>
		<content:encoded><![CDATA[<p>As I thought about it, I became curious why there&#8217;s a problem with &#8220;object MyNat extends Nat {&#8230;&#8221;.  It seems pretty clear that I would just be asking the type checker to verify that MyNat is compatible with the Nat type at the point that MyNat is defined.  Even with abstract classes the compiler could just quietly create a trait/interface for Nat and use the standard mechanisms for ensuring that instantiable subclasses/objects implement that trait.</p>
<p>e.g. (this is obviously silly, but&#8230;)<br />
type Nat = {&#8230;}</p>
<p>abstract class MyPartialNat extends Nat {<br />
   type T = int<br />
   val z = 0<br />
}</p>
<p>object MyNat extends MyPartialNat {<br />
   def s(arg:Int) = arg + 1<br />
}</p>
<p>object MyWeirdNat extends MyPartialNat {<br />
   def s(arg:Int) = arg - 1<br />
}</p>
<p>could translate into</p>
<p>type Nat {&#8230;}</p>
<p>trait Nat$Trait {&#8230;} // compiler generated trait</p>
<p>abstract class MyParitalNat extends AnyRef with Nat$Trait {<br />
&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: washburn</title>
		<link>http://existentialtype.net/2008/05/26/modules-in-scala/comment-page-1/#comment-22804</link>
		<dc:creator>washburn</dc:creator>
		<pubDate>Mon, 26 May 2008 19:51:17 +0000</pubDate>
		<guid isPermaLink="false">http://existentialtype.net/?p=245#comment-22804</guid>
		<description>@Daniel: That would be great.  I actually need to do a little more work on the GeSHi definition I wrote for Scala, if for no other reason than to make it use a more coherent color scheme.

@James: It probably just seemed more natural to me as I am used to thinking about these things in terms of Featherweight Scala which only has traits.  It is reasonable to think of  &lt;code&gt;object&lt;/code&gt;s as modules that have not been ascribed a signature.  For example, I could have written my example above like:
&lt;pre lang="scala"&gt;
scala&gt; type Nat = { type T; val z: T; def s(arg: T): T }
defined type alias Nat

scala&gt; object MyNat {
     &#124;   type T = Int
     &#124;   val z = 0
     &#124;   def s(arg: Int) = arg + 1
     &#124; }
defined module MyNat

scala&gt; val opaqueNat : Nat = MyNat
opaqueNat: Nat = MyNat$@ec8f6e
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>@Daniel: That would be great.  I actually need to do a little more work on the GeSHi definition I wrote for Scala, if for no other reason than to make it use a more coherent color scheme.</p>
<p>@James: It probably just seemed more natural to me as I am used to thinking about these things in terms of Featherweight Scala which only has traits.  It is reasonable to think of  <code>object</code>s as modules that have not been ascribed a signature.  For example, I could have written my example above like:</p>
<pre lang="scala">
scala> type Nat = { type T; val z: T; def s(arg: T): T }
defined type alias Nat

scala> object MyNat {
     |   type T = Int
     |   val z = 0
     |   def s(arg: Int) = arg + 1
     | }
defined module MyNat

scala> val opaqueNat : Nat = MyNat
opaqueNat: Nat = MyNat$@ec8f6e
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: ∃xistential Type &#187; Functors in Scala</title>
		<link>http://existentialtype.net/2008/05/26/modules-in-scala/comment-page-1/#comment-22803</link>
		<dc:creator>∃xistential Type &#187; Functors in Scala</dc:creator>
		<pubDate>Mon, 26 May 2008 19:42:28 +0000</pubDate>
		<guid isPermaLink="false">http://existentialtype.net/?p=245#comment-22803</guid>
		<description>[...] on my earlier entry on modules in Scala, I'll give an encoding of Standard ML style functors here. You can get a pretty close approximation [...]</description>
		<content:encoded><![CDATA[<p>[...] on my earlier entry on modules in Scala, I&#8217;ll give an encoding of Standard ML style functors here. You can get a pretty close approximation [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: James Iry</title>
		<link>http://existentialtype.net/2008/05/26/modules-in-scala/comment-page-1/#comment-22802</link>
		<dc:creator>James Iry</dc:creator>
		<pubDate>Mon, 26 May 2008 19:02:51 +0000</pubDate>
		<guid isPermaLink="false">http://existentialtype.net/?p=245#comment-22802</guid>
		<description>I was stubbornly trying to stick with the "object" keyword as in
type Nat = {...
object MyNat extends Nat {...

or

object MyNat extends AnyRef with Nat {...

I don't know why I hadn't considered just val MyNat = new Nat {...

I think it's because I wanted a top level construct.</description>
		<content:encoded><![CDATA[<p>I was stubbornly trying to stick with the &#8220;object&#8221; keyword as in<br />
type Nat = {&#8230;<br />
object MyNat extends Nat {&#8230;</p>
<p>or</p>
<p>object MyNat extends AnyRef with Nat {&#8230;</p>
<p>I don&#8217;t know why I hadn&#8217;t considered just val MyNat = new Nat {&#8230;</p>
<p>I think it&#8217;s because I wanted a top level construct.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Daniel Spiewak</title>
		<link>http://existentialtype.net/2008/05/26/modules-in-scala/comment-page-1/#comment-22800</link>
		<dc:creator>Daniel Spiewak</dc:creator>
		<pubDate>Mon, 26 May 2008 16:56:05 +0000</pubDate>
		<guid isPermaLink="false">http://existentialtype.net/?p=245#comment-22800</guid>
		<description>Nice!

BTW, I have a GeSHi definition file for SML if you want it.  I wrote it for my blog originally, so I didn't bother putting colors into the PHP (it's dependent on CSS and/or a hacky modification of geshi.php), but it wouldn't be too hard to modify to work with a conventional WP-Syntax setup..</description>
		<content:encoded><![CDATA[<p>Nice!</p>
<p>BTW, I have a GeSHi definition file for SML if you want it.  I wrote it for my blog originally, so I didn&#8217;t bother putting colors into the PHP (it&#8217;s dependent on CSS and/or a hacky modification of geshi.php), but it wouldn&#8217;t be too hard to modify to work with a conventional WP-Syntax setup..</p>
]]></content:encoded>
	</item>
</channel>
</rss>
