<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>∃xistential Type &#187; software</title>
	<atom:link href="http://existentialtype.net/category/software/feed/" rel="self" type="application/rss+xml" />
	<link>http://existentialtype.net</link>
	<description>For People Who Like Type and Types</description>
	<lastBuildDate>Fri, 29 Oct 2010 15:00:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Mining Yahoo Images for color schemes</title>
		<link>http://existentialtype.net/2009/08/24/mining-yahoo-images-for-color-schemes/</link>
		<comments>http://existentialtype.net/2009/08/24/mining-yahoo-images-for-color-schemes/#comments</comments>
		<pubDate>Mon, 24 Aug 2009 18:50:38 +0000</pubDate>
		<dc:creator>washburn</dc:creator>
				<category><![CDATA[graphic design]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[color]]></category>

		<guid isPermaLink="false">http://existentialtype.net/?p=336</guid>
		<description><![CDATA[I meant to post about this a while ago, but while reading Bruce Sterlings's Beyond the Beyond, I learned about this clever tool for generating color schemes. Given your keywords it searches for the top five images on Yahoo! Image Search and chooses the six most prominent colors from each. Perhaps unsurprisingly, given "existential type" [...]]]></description>
			<content:encoded><![CDATA[<p>I meant to post about this a while ago, but while reading <a href="http://www.wired.com/beyond_the_beyond/2009/07/peculiar-web-toy-may-in-fact-be-useful/">Bruce Sterlings's Beyond the Beyond</a>, I learned about <a href="http://www.gpeters.com/color/color-schemes.php">this clever tool for generating color schemes</a>.  Given your keywords it searches for the top five images on <a href="http://images.search.yahoo.com/">Yahoo! Image Search</a> and chooses the six most prominent colors from each.</p>
<p>Perhaps unsurprisingly, given "existential type" it just returns different shades of gray – ones even less interesting than Bruce got for "cyberpunk".</p>
]]></content:encoded>
			<wfw:commentRss>http://existentialtype.net/2009/08/24/mining-yahoo-images-for-color-schemes/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Finding symbols graphically</title>
		<link>http://existentialtype.net/2009/08/10/finding-symbols-graphically/</link>
		<comments>http://existentialtype.net/2009/08/10/finding-symbols-graphically/#comments</comments>
		<pubDate>Mon, 10 Aug 2009 15:22:01 +0000</pubDate>
		<dc:creator>washburn</dc:creator>
				<category><![CDATA[fonts]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[typography]]></category>
		<category><![CDATA[detexify]]></category>
		<category><![CDATA[handwriting recognition]]></category>
		<category><![CDATA[latex]]></category>
		<category><![CDATA[symbols]]></category>
		<category><![CDATA[tex]]></category>

		<guid isPermaLink="false">http://existentialtype.net/?p=329</guid>
		<description><![CDATA[Jeff pointed me to these extremely cool and useful web application: Detexify2.  At least a few of you readers have spent time skimming The Comprehensive LaTeX Symbol List looking for the incantation required for a specific symbol. With Detexify2 you can just scribble something that roughly looks the symbol and it will tell you the [...]]]></description>
			<content:encoded><![CDATA[<p>Jeff pointed me to these extremely cool and useful web application: <a href="http://detexify.kirelabs.org/classify.html">Detexify<sup>2</sup></a>.  At least a few of you readers have spent time skimming <a href="http://www.ctan.org/tex-archive/info/symbols/comprehensive/">The Comprehensive LaTeX Symbol List</a> looking for the incantation required for a specific symbol.  With Detexify<sup>2</sup> you can just scribble something that roughly looks the symbol and it will tell you the name and, if necessary, the LaTeX package that provides it.</p>
<p>The only problem is that it lets users help train the recognizer.  This can also be a good thing, but I can imagine a few malicious users (or perhaps just people with very bad drawing skills) ruining it for everyone.</p>
]]></content:encoded>
			<wfw:commentRss>http://existentialtype.net/2009/08/10/finding-symbols-graphically/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Literally dependent types</title>
		<link>http://existentialtype.net/2008/07/21/literally-dependent-types/</link>
		<comments>http://existentialtype.net/2008/07/21/literally-dependent-types/#comments</comments>
		<pubDate>Mon, 21 Jul 2008 17:26:29 +0000</pubDate>
		<dc:creator>washburn</dc:creator>
				<category><![CDATA[hacking]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[types]]></category>
		<category><![CDATA[dependent types]]></category>
		<category><![CDATA[implicit conversions]]></category>
		<category><![CDATA[literals]]></category>
		<category><![CDATA[scala]]></category>

		<guid isPermaLink="false">http://existentialtype.net/?p=264</guid>
		<description><![CDATA[Given that the formalization of Scala Classic has ground to a halt, for reasons I may go into later, I spent part of today hacking on the Scala compiler itself to add support for singleton literals. Currently, Scala allows singleton types for stable identifiers. My modification allows literals to be used in singleton types. I [...]]]></description>
			<content:encoded><![CDATA[<p>Given that <a href="http://existentialtype.net/2008/07/13/even-better-than-the-real-thing/">the formalization of Scala Classic</a> has ground to a halt, for reasons I may go into later, I spent part of today hacking on the Scala compiler itself to add support for singleton literals. Currently, Scala allows singleton types for stable identifiers.  My modification allows literals to be used in singleton types.  I can't promise that it will be in the forthcoming Scala 2.7.2 release, but I would like it to be.</p>
<p>Overall it was far less work than I was expecting.  Scala already internally supports what it calls "constant types", there is just no way to write them in Scala source code presently.  Consequently, most of the effort was in extending the parser.</p>
<p>Given my modifications, it is now possible to write code like the following:</p>
<pre class="scala">&nbsp;
scala<span style="color: #a00000;">&gt;</span> <a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">val</span></a> x <span style="color: #a00000;">:</span> <span style="color: #6666ff;">&quot;foo&quot;</span>.<a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">type</span></a> <span style="color: #a00000;">=</span> <span style="color: #6666ff;">&quot;foo&quot;</span>
x<span style="color: #a00000;">:</span> <span style="color: #6666ff;">&quot;foo&quot;</span>.<a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">type</span></a> <span style="color: #a00000;">=</span> foo
&nbsp;</pre>
<p>What I was not expecting was that out-of-the-box things like the following would work:</p>
<pre class="scala">&nbsp;
scala<span style="color: #a00000;">&gt;</span> <a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">val</span></a> x <span style="color: #a00000;">:</span> <span style="color: #6666ff;">&quot;foobar&quot;</span>.<a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">type</span></a> <span style="color: #a00000;">=</span> <span style="color: #6666ff;">&quot;foo&quot;</span> + <span style="color: #6666ff;">&quot;bar&quot;</span>
x<span style="color: #a00000;">:</span> <span style="color: #6666ff;">&quot;foobar&quot;</span>.<a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">type</span></a> <span style="color: #a00000;">=</span> foobar
scala<span style="color: #a00000;">&gt;</span> <a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">val</span></a> y <span style="color: #a00000;">:</span> <span style="color: #f78811;">10</span>.<a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">type</span></a> <span style="color: #a00000;">=</span> <span style="color: #f78811;">2</span> <span style="color: #a00000;">*</span> <span style="color: #f78811;">5</span>
y<span style="color: #a00000;">:</span> <span style="color: #f78811;">10</span>.<a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">type</span></a> <span style="color: #a00000;">=</span> <span style="color: #f78811;">10</span>
scala<span style="color: #a00000;">&gt;</span> <a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">def</span></a> frob<span style="color: #e77801;">&#40;</span>arg <span style="color: #a00000;">:</span> <span style="color: #f78811;">10</span>.<a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">type</span></a><span style="color: #e77801;">&#41;</span> <span style="color: #a00000;">:</span> <span style="color: #f78811;">6</span>.<a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">type</span></a> <span style="color: #a00000;">=</span> arg - <span style="color: #f78811;">4</span>
frob<span style="color: #a00000;">:</span> <span style="color: #e77801;">&#40;</span><span style="color: #f78811;">10</span>.<a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">type</span></a><span style="color: #e77801;">&#41;</span><span style="color: #f78811;">6</span>.<a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">type</span></a>
&nbsp;</pre>
<p>Unfortunately the excitement soon passes when you realize all the things you can't do with singleton literals (yet).  Even if we turn on the experimental dependent method support, you can't write things like</p>
<pre class="scala">&nbsp;
<a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">def</span></a> add<span style="color: #e77801;">&#40;</span>arg <span style="color: #a00000;">:</span> <a href="http://www.scala-lang.org/docu/files/api/index.html"><span style="color: #5555cc;">Int</span></a><span style="color: #e77801;">&#41;</span> <span style="color: #a00000;">:</span> <span style="color: #e77801;">&#40;</span>arg + <span style="color: #f78811;">5</span><span style="color: #e77801;">&#41;</span>.<a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">type</span></a> <span style="color: #a00000;">=</span> arg + <span style="color: #f78811;">5</span>
&nbsp;</pre>
<p>because these are exactly what they are called, singleton literals, not full-blown dependent types.</p>
<p>One cute example, based on a use suggested by Sean McDirmid, would be that some people might do something like the following with implicits:</p>
<pre class="scala">&nbsp;
<a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">implicit</span></a> stringToColor<span style="color: #e77801;">&#40;</span>arg <span style="color: #a00000;">:</span> <a href="http://www.scala-lang.org/docu/files/api/index.html"><span style="color: #99cc99;">String</span></a><span style="color: #e77801;">&#41;</span> <span style="color: #a00000;">:</span> java.<span style="color: #006600;">awt</span>.<span style="color: #006600;">Color</span> <span style="color: #a00000;">=</span> java.<span style="color: #006600;">awt</span>.<span style="color: #006600;">Color</span>.<span style="color: #006600;">getColor</span><span style="color: #e77801;">&#40;</span>arg<span style="color: #e77801;">&#41;</span>
&nbsp;</pre>
<p>However, with singleton literals you can tighten it up by ensuring that for some strings it will never fail:</p>
<pre class="scala">&nbsp;
<a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">implicit</span></a> redToColor<span style="color: #e77801;">&#40;</span>arg <span style="color: #a00000;">:</span> <span style="color: #6666ff;">&quot;red&quot;</span>.<a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">type</span></a><span style="color: #e77801;">&#41;</span> <span style="color: #a00000;">:</span> java.<span style="color: #006600;">awt</span>.<span style="color: #006600;">Color</span> <span style="color: #a00000;">=</span> java.<span style="color: #006600;">awt</span>.<span style="color: #006600;">Color</span>.<span style="color: #006600;">RED</span>
<a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">implicit</span></a> blueToColor<span style="color: #e77801;">&#40;</span>arg <span style="color: #a00000;">:</span> <span style="color: #6666ff;">&quot;blue&quot;</span>.<a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">type</span></a><span style="color: #e77801;">&#41;</span> <span style="color: #a00000;">:</span> java.<span style="color: #006600;">awt</span>.<span style="color: #006600;">Color</span> <span style="color: #a00000;">=</span> java.<span style="color: #006600;">awt</span>.<span style="color: #006600;">Color</span>.<span style="color: #006600;">BLUE</span>
&nbsp;</pre>
<p>Happily, the type inferencer already chooses the most specific implicit conversions.</p>
<p>In any event, they will hopefully become more useful as the type system continues to grow.  I am also sure someone will probably come up with a clever use for them that hasn't occurred to me yet.  If so, let me know.</p>
]]></content:encoded>
			<wfw:commentRss>http://existentialtype.net/2008/07/21/literally-dependent-types/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Functors in Scala</title>
		<link>http://existentialtype.net/2008/05/26/functors-in-scala/</link>
		<comments>http://existentialtype.net/2008/05/26/functors-in-scala/#comments</comments>
		<pubDate>Mon, 26 May 2008 19:42:19 +0000</pubDate>
		<dc:creator>washburn</dc:creator>
				<category><![CDATA[hacking]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[types]]></category>
		<category><![CDATA[functors]]></category>
		<category><![CDATA[modules]]></category>
		<category><![CDATA[scala]]></category>
		<category><![CDATA[sml]]></category>

		<guid isPermaLink="false">http://existentialtype.net/?p=246</guid>
		<description><![CDATA[Following 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 by using class constructor arguments. However, I am going to cheat a little to get the closest encoding I think is possible by using the experimental support for dependent [...]]]></description>
			<content:encoded><![CDATA[<p>Following on my earlier entry on <a href="http://existentialtype.net/2008/05/26/modules-in-scala/">modules in Scala</a>, I'll give an encoding of Standard ML style functors here.  You can get a pretty close approximation by using <code>class</code> constructor arguments.  However, I am going to cheat a little to get the closest encoding I think is possible by using the experimental support for dependent method types.  You can get this by running <code>scala</code> or <code>scalac</code> with the option <code>-Xexperimental</code>.  It works okay at least some of the time, but no one has the time at the moment to commit to getting it in shape for general consumption.</p>
<p>So here is my example of how the encoding works.  First, the SML version:</p>
<pre>&nbsp;
signature Eq = sig
  type t
  val eq: t -&gt; t -&gt; bool
end
&nbsp;
signature RicherEq = sig
  include Eq
  val neq: t -&gt; t -&gt; bool
end
&nbsp;
functor mkRicherEq(arg : Eq) :&gt; RicherEq where type t = arg.t = struct
  type t = arg.t
  val eq = arg.eq
  fun neq x y = not (eq x y)
end
&nbsp;</pre>
<p>We can transliterate this example into Scala as:</p>
<pre class="scala">&nbsp;
<a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">type</span></a> Eq <span style="color: #a00000;">=</span> <span style="color: #e77801;">&#123;</span>
  <a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">type</span></a> T
  <a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">def</span></a> eq<span style="color: #e77801;">&#40;</span>x<span style="color: #a00000;">:</span> T<span style="color: #a00000;">,</span> y<span style="color: #a00000;">:</span> T<span style="color: #e77801;">&#41;</span><span style="color: #a00000;">:</span> <a href="http://www.scala-lang.org/docu/files/api/index.html"><span style="color: #5555cc;">Boolean</span></a>
<span style="color: #e77801;">&#125;</span>
&nbsp;
<a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">type</span></a> RicherEq <span style="color: #a00000;">=</span> <span style="color: #e77801;">&#123;</span>
  <a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">type</span></a> T
  <a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">def</span></a> eq<span style="color: #e77801;">&#40;</span>x<span style="color: #a00000;">:</span> T<span style="color: #a00000;">,</span> y<span style="color: #a00000;">:</span> T<span style="color: #e77801;">&#41;</span><span style="color: #a00000;">:</span> <a href="http://www.scala-lang.org/docu/files/api/index.html"><span style="color: #5555cc;">Boolean</span></a>
  <a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">def</span></a> neq<span style="color: #e77801;">&#40;</span>x<span style="color: #a00000;">:</span> T<span style="color: #a00000;">,</span> y<span style="color: #a00000;">:</span> T<span style="color: #e77801;">&#41;</span><span style="color: #a00000;">:</span> <a href="http://www.scala-lang.org/docu/files/api/index.html"><span style="color: #5555cc;">Boolean</span></a>
<span style="color: #e77801;">&#125;</span>
&nbsp;
<a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">def</span></a> mkRicherEq<span style="color: #e77801;">&#40;</span>arg<span style="color: #a00000;">:</span> Eq<span style="color: #e77801;">&#41;</span> <span style="color: #a00000;">:</span> RicherEq <span style="color: #e77801;">&#123;</span> <a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">type</span></a> T <span style="color: #a00000;">=</span> arg.<span style="color: #006600;">T</span> <span style="color: #e77801;">&#125;</span> <span style="color: #a00000;">=</span> <a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">new</span></a> <span style="color: #e77801;">&#123;</span>
  <a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">type</span></a> T <span style="color: #a00000;">=</span> arg.<span style="color: #006600;">T</span>
  <a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">def</span></a> eq<span style="color: #e77801;">&#40;</span>x<span style="color: #a00000;">:</span> T<span style="color: #a00000;">,</span> y<span style="color: #a00000;">:</span> T<span style="color: #e77801;">&#41;</span> <span style="color: #a00000;">=</span> arg.<span style="color: #006600;">eq</span><span style="color: #e77801;">&#40;</span>x<span style="color: #a00000;">,</span> y<span style="color: #e77801;">&#41;</span>
  <a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">def</span></a> neq<span style="color: #e77801;">&#40;</span>x<span style="color: #a00000;">:</span> T<span style="color: #a00000;">,</span> y<span style="color: #a00000;">:</span>T<span style="color: #e77801;">&#41;</span> <span style="color: #a00000;">=</span> <span style="color: #a00000;">!</span>eq<span style="color: #e77801;">&#40;</span>x<span style="color: #a00000;">,</span> y<span style="color: #e77801;">&#41;</span>
<span style="color: #e77801;">&#125;</span>
&nbsp;</pre>
<p>The only problem I discovered is that it is not possible to define <code>RicherEq</code> in terms of <code>Eq</code> as we could in SML:</p>
<pre class="scala">&nbsp;
scala<span style="color: #a00000;">&gt;</span> <a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">type</span></a> RicherEq <span style="color: #a00000;">=</span> Eq <span style="color: #e77801;">&#123;</span> <a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">def</span></a> neq<span style="color: #e77801;">&#40;</span>x<span style="color: #a00000;">:</span> T<span style="color: #a00000;">,</span> y<span style="color: #a00000;">:</span> T<span style="color: #e77801;">&#41;</span><span style="color: #a00000;">:</span> <a href="http://www.scala-lang.org/docu/files/api/index.html"><span style="color: #5555cc;">Boolean</span></a> <span style="color: #e77801;">&#125;</span>
<span style="color: #a00000;">&lt;</span>console<span style="color: #a00000;">&gt;:</span><span style="color: #f78811;">5</span><span style="color: #a00000;">:</span> error<span style="color: #a00000;">:</span> Parameter <a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">type</span></a> in structural refinement may
not refer to <a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">abstract</span></a> <a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">type</span></a> defined outside that same refinement
       <a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">type</span></a> RicherEq <span style="color: #a00000;">=</span> Eq <span style="color: #e77801;">&#123;</span> <a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">def</span></a> neq<span style="color: #e77801;">&#40;</span>x<span style="color: #a00000;">:</span> T<span style="color: #a00000;">,</span> y<span style="color: #a00000;">:</span> T<span style="color: #e77801;">&#41;</span><span style="color: #a00000;">:</span> <a href="http://www.scala-lang.org/docu/files/api/index.html"><span style="color: #5555cc;">Boolean</span></a> <span style="color: #e77801;">&#125;</span>
                                       ^
<span style="color: #a00000;">&lt;</span>console<span style="color: #a00000;">&gt;:</span><span style="color: #f78811;">5</span><span style="color: #a00000;">:</span> error<span style="color: #a00000;">:</span> Parameter <a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">type</span></a> in structural refinement may
not refer to <a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">abstract</span></a> <a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">type</span></a> defined outside that same refinement
       <a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">type</span></a> RicherEq <span style="color: #a00000;">=</span> Eq <span style="color: #e77801;">&#123;</span> <a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">def</span></a> neq<span style="color: #e77801;">&#40;</span>x<span style="color: #a00000;">:</span> T<span style="color: #a00000;">,</span> y<span style="color: #a00000;">:</span> T<span style="color: #e77801;">&#41;</span><span style="color: #a00000;">:</span> <a href="http://www.scala-lang.org/docu/files/api/index.html"><span style="color: #5555cc;">Boolean</span></a> <span style="color: #e77801;">&#125;</span>
                                             ^
&nbsp;</pre>
<p>Why this restriction exists I don't know.  In fact, this sort of refinement should work in the current version of Featherweight Scala, so perhaps it can be lifted eventually.</p>
<p>I still need to think about higher-order functors, and probably spend a few minutes researching existing proposals.  I think this is probably something that cannot be easily supported in Scala if it will require allowing method invocations to appear in paths.  However, off hand that only seems like it should be necessary for applicative higher-order functors, but again I definitely need to think it through.</p>
]]></content:encoded>
			<wfw:commentRss>http://existentialtype.net/2008/05/26/functors-in-scala/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Modules in Scala</title>
		<link>http://existentialtype.net/2008/05/26/modules-in-scala/</link>
		<comments>http://existentialtype.net/2008/05/26/modules-in-scala/#comments</comments>
		<pubDate>Mon, 26 May 2008 15:48:18 +0000</pubDate>
		<dc:creator>washburn</dc:creator>
				<category><![CDATA[hacking]]></category>
		<category><![CDATA[languages]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[types]]></category>
		<category><![CDATA[modules]]></category>
		<category><![CDATA[scala]]></category>
		<category><![CDATA[sml]]></category>

		<guid isPermaLink="false">http://existentialtype.net/?p=245</guid>
		<description><![CDATA[I just saw a thread on Lambda the Ultimate where I think the expressive power of Scala in comparison to Standard ML's module system was misrepresented. I don't want to go into all of the issues at the moment, but I figured out would point out that you can get the same structural typing, opaque [...]]]></description>
			<content:encoded><![CDATA[<p>I just saw a <a href="http://lambda-the-ultimate.org/node/2808">thread on Lambda the Ultimate</a> where I think the expressive power of Scala in comparison to Standard ML's module system was misrepresented.  I don't want to go into all of the issues at the moment, but I figured out would point out that you can get the same structural typing, opaque sealing, and even the equivalent of SML's <code>where type</code> clause.  </p>
<p>For example, consider the following SML signature:</p>
<pre>&nbsp;
signature Nat = sig
  type t
  val z: t
  val s: t -&gt; t
end
&nbsp;</pre>
<p>This signature can be translated in to Scala as:</p>
<pre class="scala">&nbsp;
<a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">type</span></a> Nat <span style="color: #a00000;">=</span> <span style="color: #e77801;">&#123;</span>
  <a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">type</span></a> T
  <a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">val</span></a> z<span style="color: #a00000;">:</span> T
  <a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">def</span></a> s<span style="color: #e77801;">&#40;</span>arg<span style="color: #a00000;">:</span> T<span style="color: #e77801;">&#41;</span><span style="color: #a00000;">:</span> T
<span style="color: #e77801;">&#125;</span>
&nbsp;</pre>
<p>It is then possible to create an implementation of this type, and opaquely seal it (hiding the definition of <code>T</code>).  In SML:</p>
<pre>&nbsp;
structure nat :&gt; Nat = struct
  type t = int
  val z = 0
  fun s n = n + 1
end
&nbsp;</pre>
<p>In Scala:</p>
<pre class="scala">&nbsp;
<a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">val</span></a> nat <span style="color: #a00000;">:</span> Nat <span style="color: #a00000;">=</span> <a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">new</span></a> <span style="color: #e77801;">&#123;</span>
  <a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">type</span></a> T <span style="color: #a00000;">=</span> <a href="http://www.scala-lang.org/docu/files/api/index.html"><span style="color: #5555cc;">Int</span></a>
  <a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">val</span></a> z <span style="color: #a00000;">=</span> <span style="color: #f78811;">0</span>
  <a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">def</span></a> s<span style="color: #e77801;">&#40;</span>arg<span style="color: #a00000;">:</span> <a href="http://www.scala-lang.org/docu/files/api/index.html"><span style="color: #5555cc;">Int</span></a><span style="color: #e77801;">&#41;</span> <span style="color: #a00000;">=</span> arg + <span style="color: #f78811;">1</span>
<span style="color: #e77801;">&#125;</span>
&nbsp;</pre>
<p>In many cases when programming with SML modules it is necessary or convenient to give a module that reveals the definition of an abstract type.  In the above example, this can be done by adding a <code>where type</code> clause to the first line:</p>
<pre>&nbsp;
structure nat :&gt; Nat where type t = int = struct
...
&nbsp;</pre>
<p>We can do the same thing in Scala using refinements:</p>
<pre class="scala">&nbsp;
<a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">val</span></a> nat <span style="color: #a00000;">:</span> Nat <span style="color: #e77801;">&#123;</span> <a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">type</span></a> T <span style="color: #a00000;">=</span> <a href="http://www.scala-lang.org/docu/files/api/index.html"><span style="color: #5555cc;">Int</span></a> <span style="color: #e77801;">&#125;</span> <span style="color: #a00000;">=</span> <a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">new</span></a> <span style="color: #e77801;">&#123;</span>
...
&nbsp;</pre>
<p>Great, right?  Well, almost.  The problem is that structural types are still a bit buggy in Scala compiler at present.  So, while the above typechecks, you can't quite use it yet:</p>
<pre class="scala">&nbsp;
scala<span style="color: #a00000;">&gt;</span> nat.<span style="color: #006600;">s</span><span style="color: #e77801;">&#40;</span>nat.<span style="color: #006600;">z</span><span style="color: #e77801;">&#41;</span>
java.<span style="color: #006600;">lang</span>.<span style="color: #006600;">NoSuchMethodException</span><span style="color: #a00000;">:</span> $anon$<span style="color: #f78811;">1</span>.<span style="color: #006600;">s</span><span style="color: #e77801;">&#40;</span>java.<span style="color: #006600;">lang</span>.<a href="http://www.scala-lang.org/docu/files/api/index.html"><span style="color: #99cc99;">Object</span></a><span style="color: #e77801;">&#41;</span>
        at java.<span style="color: #006600;">lang</span>.<span style="color: #006600;">Class</span>.<span style="color: #006600;">getMethod</span><span style="color: #e77801;">&#40;</span>Class.<span style="color: #006600;">java</span><span style="color: #a00000;">:</span><span style="color: #f78811;">1581</span><span style="color: #e77801;">&#41;</span>
        at .<span style="color: #006600;">reflMethod</span>$Method1<span style="color: #e77801;">&#40;</span><span style="color: #a00000;">&lt;</span>console<span style="color: #a00000;">&gt;:</span><span style="color: #f78811;">7</span><span style="color: #e77801;">&#41;</span>
        at .<span style="color: #a00000;">&lt;</span>init<span style="color: #a00000;">&gt;</span><span style="color: #e77801;">&#40;</span><span style="color: #a00000;">&lt;</span>console<span style="color: #a00000;">&gt;:</span><span style="color: #f78811;">7</span><span style="color: #e77801;">&#41;</span>
        at .<span style="color: #a00000;">&lt;</span>clinit<span style="color: #a00000;">&gt;</span><span style="color: #e77801;">&#40;</span><span style="color: #a00000;">&lt;</span>console<span style="color: #a00000;">&gt;</span><span style="color: #e77801;">&#41;</span>
        at RequestResult$.<span style="color: #a00000;">&lt;</span>init<span style="color: #a00000;">&gt;</span><span style="color: #e77801;">&#40;</span><span style="color: #a00000;">&lt;</span>console<span style="color: #a00000;">&gt;:</span><span style="color: #f78811;">3</span><span style="color: #e77801;">&#41;</span>
        at RequestResult$.<span style="color: #a00000;">&lt;</span>clinit<span style="color: #a00000;">&gt;</span><span style="color: #e77801;">&#40;</span><span style="color: #a00000;">&lt;</span>console<span style="color: #a00000;">&gt;</span><span style="color: #e77801;">&#41;</span>
        at RequestResult$result<span style="color: #e77801;">&#40;</span><span style="color: #a00000;">&lt;</span>console<span style="color: #a00000;">&gt;</span><span style="color: #e77801;">&#41;</span>
        at sun.<span style="color: #006600;">reflect</span>.<span style="color: #006600;">NativeMethodAccessorImpl</span>.<span style="color: #006600;">invoke0</span><span style="color: #e77801;">&#40;</span>Native Method<span style="color: #e77801;">&#41;</span>
        at sun.<span style="color: #006600;">reflec</span>...
&nbsp;</pre>
<p>There were some issues raised about how faithful an encoding of SML functors, and well-known extensions for higher-order functors, one can get in Scala.  Indeed, off the top of my head it is not entirely clear.  So I need to think more about that before I write some examples.  </p>
]]></content:encoded>
			<wfw:commentRss>http://existentialtype.net/2008/05/26/modules-in-scala/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Revisiting higher-rank impredicative polymorphism in Scala</title>
		<link>http://existentialtype.net/2008/05/26/revisiting-higher-rank-impredicative-polymorphism-in-scala/</link>
		<comments>http://existentialtype.net/2008/05/26/revisiting-higher-rank-impredicative-polymorphism-in-scala/#comments</comments>
		<pubDate>Mon, 26 May 2008 10:23:36 +0000</pubDate>
		<dc:creator>washburn</dc:creator>
				<category><![CDATA[hacking]]></category>
		<category><![CDATA[languages]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[types]]></category>
		<category><![CDATA[bounded polymorphism]]></category>
		<category><![CDATA[higher-rank]]></category>
		<category><![CDATA[impredicativity]]></category>
		<category><![CDATA[scala]]></category>
		<category><![CDATA[type functions]]></category>
		<category><![CDATA[universal quantification]]></category>

		<guid isPermaLink="false">http://existentialtype.net/?p=243</guid>
		<description><![CDATA[I've been meaning to write this up for a while, but it seems like there has always been something else I really ought to be doing. So I expect this will be a bit more terse than I might like. Anyway, when I wrote about encoding higher-rank universal quantification in Scala back in March, I [...]]]></description>
			<content:encoded><![CDATA[<p>I've been meaning to write this up for a while, but it seems like there has always been something else I really ought to be doing.  So I expect this will be a bit more terse than I might like.  Anyway, when I wrote about <a href="http://existentialtype.net/2008/03/09/higher-rank-impredicative-polymorphism-in-scala/">encoding higher-rank universal quantification in Scala back in March</a>, I used a rather elaborate scheme involving the use of Scala's first-class existential quantifiers.  While this was the point of the exercise, surprisingly, no one called me on the fact that if you just want higher-rank impredicative polymorphism in Scala, there is a much simpler encoding.  Maybe it was obvious to everyone or no one read closely enough to think of raising the issue.  So today, I'll explain the better way to encode them.</p>
<p>First we can define an infinite family of traits to represent <i>n</i>-ary universal quantification, much like Scala represents <i>n</i>-ary functions types:</p>
<pre class="scala">&nbsp;
<a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">trait</span></a> Univ1<span style="color: #e77801;">&#91;</span>Bound1<span style="color: #a00000;">,</span>Body<span style="color: #e77801;">&#91;</span><span style="color: #a00000;">_</span><span style="color: #e77801;">&#93;</span><span style="color: #e77801;">&#93;</span> <span style="color: #e77801;">&#123;</span>
   <a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">def</span></a> Apply<span style="color: #e77801;">&#91;</span>T1<span style="color: #a00000;">&lt;:</span>Bound1<span style="color: #e77801;">&#93;</span> <span style="color: #a00000;">:</span> Body<span style="color: #e77801;">&#91;</span>T1<span style="color: #e77801;">&#93;</span>
<span style="color: #e77801;">&#125;</span>
&nbsp;
<a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">trait</span></a> Univ2<span style="color: #e77801;">&#91;</span>Bound1<span style="color: #a00000;">,</span>Bound2<span style="color: #a00000;">,</span>Body<span style="color: #e77801;">&#91;</span><span style="color: #a00000;">_,_</span><span style="color: #e77801;">&#93;</span><span style="color: #e77801;">&#93;</span> <span style="color: #e77801;">&#123;</span>
   <a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">def</span></a> Apply<span style="color: #e77801;">&#91;</span>T1<span style="color: #a00000;">&lt;:</span>Bound1<span style="color: #a00000;">,</span>T2<span style="color: #a00000;">&lt;:</span>Bound2<span style="color: #e77801;">&#93;</span> <span style="color: #a00000;">:</span> Body<span style="color: #e77801;">&#91;</span>T1<span style="color: #a00000;">,</span>T2<span style="color: #e77801;">&#93;</span>
<span style="color: #e77801;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">// ... so on for N &gt; 2</span>
&nbsp;</pre>
<p>Really, the key to this encoding is the use of higher-kinded quantification to encode the binding structure of the quantifier.  </p>
<p>Now it is possible to write some examples similar to what I gave previously, but more concisely:</p>
<pre class="scala">&nbsp;
<a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">object</span></a> Test <a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">extends</span></a> Application <span style="color: #e77801;">&#123;</span>
   <a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">def</span></a> id<span style="color: #e77801;">&#91;</span>T<span style="color: #e77801;">&#93;</span><span style="color: #e77801;">&#40;</span>x <span style="color: #a00000;">:</span> T<span style="color: #e77801;">&#41;</span> <span style="color: #a00000;">=</span> x
&nbsp;
   <a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">type</span></a> Id<span style="color: #e77801;">&#91;</span>T<span style="color: #e77801;">&#93;</span> <span style="color: #a00000;">=</span> T <span style="color: #a00000;">=&gt;</span> T
   <a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">val</span></a> id <span style="color: #a00000;">=</span> <a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">new</span></a> Univ1<span style="color: #e77801;">&#91;</span><a href="http://www.scala-lang.org/docu/files/api/index.html"><span style="color: #5555cc;">Any</span></a><span style="color: #a00000;">,</span>Id<span style="color: #e77801;">&#93;</span>
     <span style="color: #e77801;">&#123;</span> <a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">def</span></a> Apply<span style="color: #e77801;">&#91;</span>T <span style="color: #a00000;">&lt;:</span> <a href="http://www.scala-lang.org/docu/files/api/index.html"><span style="color: #5555cc;">Any</span></a><span style="color: #e77801;">&#93;</span> <span style="color: #a00000;">:</span> Id<span style="color: #e77801;">&#91;</span>T<span style="color: #e77801;">&#93;</span> <span style="color: #a00000;">=</span> id<span style="color: #e77801;">&#91;</span>T<span style="color: #e77801;">&#93;</span> <span style="color: #a00000;">_</span> <span style="color: #e77801;">&#125;</span>
&nbsp;
   <a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">val</span></a> idString <span style="color: #a00000;">=</span> id.<span style="color: #006600;">Apply</span><span style="color: #e77801;">&#91;</span><a href="http://www.scala-lang.org/docu/files/api/index.html"><span style="color: #99cc99;">String</span></a><span style="color: #e77801;">&#93;</span>
   <a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">val</span></a> idStringList <span style="color: #a00000;">=</span> id.<span style="color: #006600;">Apply</span><span style="color: #e77801;">&#91;</span><a href="http://www.scala-lang.org/docu/files/api/index.html"><span style="color: #99cc99;">List</span></a><span style="color: #e77801;">&#91;</span><a href="http://www.scala-lang.org/docu/files/api/index.html"><span style="color: #99cc99;">String</span></a><span style="color: #e77801;">&#93;</span><span style="color: #e77801;">&#93;</span>
&nbsp;
   println<span style="color: #e77801;">&#40;</span>idString<span style="color: #e77801;">&#40;</span><span style="color: #6666ff;">&quot;Foo&quot;</span><span style="color: #e77801;">&#41;</span><span style="color: #e77801;">&#41;</span>
   println<span style="color: #e77801;">&#40;</span>idStringList<span style="color: #e77801;">&#40;</span><a href="http://www.scala-lang.org/docu/files/api/index.html"><span style="color: #99cc99;">List</span></a><span style="color: #e77801;">&#40;</span><span style="color: #6666ff;">&quot;Foo&quot;</span><span style="color: #a00000;">,</span> <span style="color: #6666ff;">&quot;Bar&quot;</span><span style="color: #a00000;">,</span> <span style="color: #6666ff;">&quot;Baz&quot;</span><span style="color: #e77801;">&#41;</span><span style="color: #e77801;">&#41;</span><span style="color: #e77801;">&#41;</span>
&nbsp;
   <a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">type</span></a> <a href="http://www.scala-lang.org/docu/files/api/index.html"><span style="color: #5555cc;">Double</span></a><span style="color: #e77801;">&#91;</span>T<span style="color: #e77801;">&#93;</span> <span style="color: #a00000;">=</span> T <span style="color: #a00000;">=&gt;</span> <span style="color: #e77801;">&#40;</span>T<span style="color: #a00000;">,</span> T<span style="color: #e77801;">&#41;</span>
   <a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">val</span></a> double <span style="color: #a00000;">=</span> <a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">new</span></a> Univ1<span style="color: #e77801;">&#91;</span><a href="http://www.scala-lang.org/docu/files/api/index.html"><span style="color: #5555cc;">Any</span></a><span style="color: #a00000;">,</span><a href="http://www.scala-lang.org/docu/files/api/index.html"><span style="color: #5555cc;">Double</span></a><span style="color: #e77801;">&#93;</span>
     <span style="color: #e77801;">&#123;</span> <a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">def</span></a> Apply<span style="color: #e77801;">&#91;</span>T <span style="color: #a00000;">&lt;:</span> <a href="http://www.scala-lang.org/docu/files/api/index.html"><span style="color: #5555cc;">Any</span></a><span style="color: #e77801;">&#93;</span> <span style="color: #a00000;">:</span> <a href="http://www.scala-lang.org/docu/files/api/index.html"><span style="color: #5555cc;">Double</span></a><span style="color: #e77801;">&#91;</span>T<span style="color: #e77801;">&#93;</span> <span style="color: #a00000;">=</span> <span style="color: #e77801;">&#40;</span>x <span style="color: #a00000;">:</span> T<span style="color: #e77801;">&#41;</span> <span style="color: #a00000;">=&gt;</span> <span style="color: #e77801;">&#40;</span>x<span style="color: #a00000;">,</span> x<span style="color: #e77801;">&#41;</span> <span style="color: #e77801;">&#125;</span>
&nbsp;
   <a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">val</span></a> doubleString <span style="color: #a00000;">=</span> double.<span style="color: #006600;">Apply</span><span style="color: #e77801;">&#91;</span><a href="http://www.scala-lang.org/docu/files/api/index.html"><span style="color: #99cc99;">String</span></a><span style="color: #e77801;">&#93;</span>
   <a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">val</span></a> doubleStringList <span style="color: #a00000;">=</span> double.<span style="color: #006600;">Apply</span><span style="color: #e77801;">&#91;</span><a href="http://www.scala-lang.org/docu/files/api/index.html"><span style="color: #99cc99;">List</span></a><span style="color: #e77801;">&#91;</span><a href="http://www.scala-lang.org/docu/files/api/index.html"><span style="color: #99cc99;">String</span></a><span style="color: #e77801;">&#93;</span><span style="color: #e77801;">&#93;</span>
&nbsp;
   println<span style="color: #e77801;">&#40;</span>doubleString<span style="color: #e77801;">&#40;</span><span style="color: #6666ff;">&quot;Foo&quot;</span><span style="color: #e77801;">&#41;</span><span style="color: #e77801;">&#41;</span>
   println<span style="color: #e77801;">&#40;</span>doubleStringList<span style="color: #e77801;">&#40;</span><a href="http://www.scala-lang.org/docu/files/api/index.html"><span style="color: #99cc99;">List</span></a><span style="color: #e77801;">&#40;</span><span style="color: #6666ff;">&quot;Foo&quot;</span><span style="color: #a00000;">,</span> <span style="color: #6666ff;">&quot;Bar&quot;</span><span style="color: #a00000;">,</span> <span style="color: #6666ff;">&quot;Baz&quot;</span><span style="color: #e77801;">&#41;</span><span style="color: #e77801;">&#41;</span><span style="color: #e77801;">&#41;</span>
<span style="color: #e77801;">&#125;</span>
&nbsp;</pre>
<p>As I mentioned previously, this example would be much improved by support for anonymous type functions in Scala.  I am pretty sure Scala will eventually support them, as they would not require any deep changes in the implementation. They could be just implemented by desugaring to a higher-kinded type alias with a fresh name, but depending on when that desugaring is performed, it is possible that it would result in poor error messages.  Supporting curried type functions is also quite desirable, but given my current knowledge of the internals, that seems like adding them will require some more elaborate changes.</p>
<p>I think  <a href="http://lamp.epfl.ch/~cremet/">Vincent Cremet</a> was the first person to suggest this sort of encoding, and I vaguely recall reading about it on one of the Scala mailing lists, but I could not find the message after a little bit of time spent searching.</p>
]]></content:encoded>
			<wfw:commentRss>http://existentialtype.net/2008/05/26/revisiting-higher-rank-impredicative-polymorphism-in-scala/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>An unusual definition of total ordering</title>
		<link>http://existentialtype.net/2008/04/09/an-unusual-definition-of-total-ordering/</link>
		<comments>http://existentialtype.net/2008/04/09/an-unusual-definition-of-total-ordering/#comments</comments>
		<pubDate>Wed, 09 Apr 2008 15:16:03 +0000</pubDate>
		<dc:creator>washburn</dc:creator>
				<category><![CDATA[hacking]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[theory]]></category>
		<category><![CDATA[equivalence]]></category>
		<category><![CDATA[partial order]]></category>
		<category><![CDATA[properties]]></category>
		<category><![CDATA[relations]]></category>
		<category><![CDATA[scala]]></category>
		<category><![CDATA[total order]]></category>

		<guid isPermaLink="false">http://existentialtype.net/?p=237</guid>
		<description><![CDATA[One of the things that will show up in the imminently forthcoming Scala 2.7.1 release candidate, is the addition of traits for representing equivalence relations, partial orderings, and total orderings. Previously, the trait Ordered was used for representing totally ordered things: trait Ordered&#91;A&#93; &#123; def compare&#40;that: A&#41;: Int def &#60; &#40;that: A&#41;: Boolean = &#40;this [...]]]></description>
			<content:encoded><![CDATA[<p>One of the things that will show up in the imminently forthcoming Scala 2.7.1 release candidate, is the addition of traits for representing equivalence relations, partial orderings, and total orderings.  Previously,  the trait <code lang="scala">Ordered</code> was used for representing totally ordered things:</p>
<blockquote>
<pre class="scala"><a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">trait</span></a> Ordered<span style="color: #e77801;">&#91;</span>A<span style="color: #e77801;">&#93;</span> <span style="color: #e77801;">&#123;</span>
<a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">def</span></a> compare<span style="color: #e77801;">&#40;</span>that<span style="color: #a00000;">:</span> A<span style="color: #e77801;">&#41;</span><span style="color: #a00000;">:</span> <a href="http://www.scala-lang.org/docu/files/api/index.html"><span style="color: #5555cc;">Int</span></a>
<a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">def</span></a> <span style="color: #a00000;">&lt;</span>  <span style="color: #e77801;">&#40;</span>that<span style="color: #a00000;">:</span> A<span style="color: #e77801;">&#41;</span><span style="color: #a00000;">:</span> <a href="http://www.scala-lang.org/docu/files/api/index.html"><span style="color: #5555cc;">Boolean</span></a> <span style="color: #a00000;">=</span> <span style="color: #e77801;">&#40;</span><a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">this</span></a> compare that<span style="color: #e77801;">&#41;</span> <span style="color: #a00000;">&lt;</span>  <span style="color: #f78811;">0</span>
<a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">def</span></a> <span style="color: #a00000;">&gt;</span>  <span style="color: #e77801;">&#40;</span>that<span style="color: #a00000;">:</span> A<span style="color: #e77801;">&#41;</span><span style="color: #a00000;">:</span> <a href="http://www.scala-lang.org/docu/files/api/index.html"><span style="color: #5555cc;">Boolean</span></a> <span style="color: #a00000;">=</span> <span style="color: #e77801;">&#40;</span><a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">this</span></a> compare that<span style="color: #e77801;">&#41;</span> <span style="color: #a00000;">&gt;</span>  <span style="color: #f78811;">0</span>
<a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">def</span></a> <span style="color: #a00000;">&lt;=</span> <span style="color: #e77801;">&#40;</span>that<span style="color: #a00000;">:</span> A<span style="color: #e77801;">&#41;</span><span style="color: #a00000;">:</span> <a href="http://www.scala-lang.org/docu/files/api/index.html"><span style="color: #5555cc;">Boolean</span></a> <span style="color: #a00000;">=</span> <span style="color: #e77801;">&#40;</span><a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">this</span></a> compare that<span style="color: #e77801;">&#41;</span> <span style="color: #a00000;">&lt;=</span> <span style="color: #f78811;">0</span>
<a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">def</span></a> <span style="color: #a00000;">&gt;=</span> <span style="color: #e77801;">&#40;</span>that<span style="color: #a00000;">:</span> A<span style="color: #e77801;">&#41;</span><span style="color: #a00000;">:</span> <a href="http://www.scala-lang.org/docu/files/api/index.html"><span style="color: #5555cc;">Boolean</span></a> <span style="color: #a00000;">=</span> <span style="color: #e77801;">&#40;</span><a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">this</span></a> compare that<span style="color: #e77801;">&#41;</span> <span style="color: #a00000;">&gt;=</span> <span style="color: #f78811;">0</span>
<a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">def</span></a> compareTo<span style="color: #e77801;">&#40;</span>that<span style="color: #a00000;">:</span> A<span style="color: #e77801;">&#41;</span><span style="color: #a00000;">:</span> <a href="http://www.scala-lang.org/docu/files/api/index.html"><span style="color: #5555cc;">Int</span></a> <span style="color: #a00000;">=</span> compare<span style="color: #e77801;">&#40;</span>that<span style="color: #e77801;">&#41;</span>
<span style="color: #e77801;">&#125;</span></pre>
</blockquote>
<p>However, the <code lang="scala">Ordered</code> trait does not provide a representation of a total ordering.  Therefore, the new trait <code>Ordering</code>:</p>
<blockquote>
<pre class="scala">&nbsp;
<a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">trait</span></a> Ordering<span style="color: #e77801;">&#91;</span>T<span style="color: #e77801;">&#93;</span> <a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">extends</span></a> PartialOrdering<span style="color: #e77801;">&#91;</span>T<span style="color: #e77801;">&#93;</span> <span style="color: #e77801;">&#123;</span>
  <a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">def</span></a> compare<span style="color: #e77801;">&#40;</span>x<span style="color: #a00000;">:</span> T<span style="color: #a00000;">,</span> y<span style="color: #a00000;">:</span> T<span style="color: #e77801;">&#41;</span><span style="color: #a00000;">:</span> <a href="http://www.scala-lang.org/docu/files/api/index.html"><span style="color: #5555cc;">Int</span></a>
  <a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">override</span></a> <a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">def</span></a> lteq<span style="color: #e77801;">&#40;</span>x<span style="color: #a00000;">:</span> T<span style="color: #a00000;">,</span> y<span style="color: #a00000;">:</span> T<span style="color: #e77801;">&#41;</span><span style="color: #a00000;">:</span> <a href="http://www.scala-lang.org/docu/files/api/index.html"><span style="color: #5555cc;">Boolean</span></a> <span style="color: #a00000;">=</span> compare<span style="color: #e77801;">&#40;</span>x<span style="color: #a00000;">,</span> y<span style="color: #e77801;">&#41;</span> <span style="color: #a00000;">&lt;=</span> <span style="color: #f78811;">0</span>
  <a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">override</span></a> <a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">def</span></a> gteq<span style="color: #e77801;">&#40;</span>x<span style="color: #a00000;">:</span> T<span style="color: #a00000;">,</span> y<span style="color: #a00000;">:</span> T<span style="color: #e77801;">&#41;</span><span style="color: #a00000;">:</span> <a href="http://www.scala-lang.org/docu/files/api/index.html"><span style="color: #5555cc;">Boolean</span></a> <span style="color: #a00000;">=</span> compare<span style="color: #e77801;">&#40;</span>x<span style="color: #a00000;">,</span> y<span style="color: #e77801;">&#41;</span> <span style="color: #a00000;">&gt;=</span> <span style="color: #f78811;">0</span>
  <a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">override</span></a> <a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">def</span></a> lt<span style="color: #e77801;">&#40;</span>x<span style="color: #a00000;">:</span> T<span style="color: #a00000;">,</span> y<span style="color: #a00000;">:</span> T<span style="color: #e77801;">&#41;</span><span style="color: #a00000;">:</span> <a href="http://www.scala-lang.org/docu/files/api/index.html"><span style="color: #5555cc;">Boolean</span></a> <span style="color: #a00000;">=</span> compare<span style="color: #e77801;">&#40;</span>x<span style="color: #a00000;">,</span> y<span style="color: #e77801;">&#41;</span> <span style="color: #a00000;">&lt;</span> <span style="color: #f78811;">0</span>
  <a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">override</span></a> <a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">def</span></a> gt<span style="color: #e77801;">&#40;</span>x<span style="color: #a00000;">:</span> T<span style="color: #a00000;">,</span> y<span style="color: #a00000;">:</span> T<span style="color: #e77801;">&#41;</span><span style="color: #a00000;">:</span> <a href="http://www.scala-lang.org/docu/files/api/index.html"><span style="color: #5555cc;">Boolean</span></a> <span style="color: #a00000;">=</span> compare<span style="color: #e77801;">&#40;</span>x<span style="color: #a00000;">,</span> y<span style="color: #e77801;">&#41;</span> <span style="color: #a00000;">&gt;</span> <span style="color: #f78811;">0</span>
  <a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">override</span></a> <a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">def</span></a> equiv<span style="color: #e77801;">&#40;</span>x<span style="color: #a00000;">:</span> T<span style="color: #a00000;">,</span> y<span style="color: #a00000;">:</span> T<span style="color: #e77801;">&#41;</span><span style="color: #a00000;">:</span> <a href="http://www.scala-lang.org/docu/files/api/index.html"><span style="color: #5555cc;">Boolean</span></a> <span style="color: #a00000;">=</span> compare<span style="color: #e77801;">&#40;</span>x<span style="color: #a00000;">,</span> y<span style="color: #e77801;">&#41;</span> <span style="color: #a00000;">==</span> <span style="color: #f78811;">0</span>
<span style="color: #e77801;">&#125;</span>
&nbsp;</pre>
</blockquote>
<p>The tricky part however, was writing description of the properties required of something that implements the <code lang="scala">Ordering</code> trait.  When one normally thinks of a <a href="http://en.wikipedia.org/wiki/Total_order">total ordering</a> one thinks of a relation that is</p>
<ul>
<li>anti-symmetric,</li>
<li>transitive,</li>
<li>and total.</li>
</ul>
<p>The problem is that <code lang="scala">Ordering</code> is not defined in terms of a binary relation, but a binary function producing integers (<code lang="scala">compare</code>).  If the first argument is less than the second the function returns a negative integer, if they are equal in the ordering the function returns zero, and if the second argument is less than the first the function returns a positive integer.  Therefore, it is not straightforward to express these same properties.  The best I could come up with was</p>
<ul>
<li><code lang="scala">compare(x, x) == 0</code>, for any <code lang="scala">x</code> of type <code lang="scala">T</code>.</li>
<li><code lang="scala">compare(x, y) == z</code> and <code lang="scala">compare(y, x) == w</code> then <code lang="scala">Math.signum(z) == -Math.signum(w)</code>, for any <code lang="scala">x</code> and <code lang="scala">y</code> of type <code lang="scala">T</code> and <code lang="scala">z</code> and <code lang="scala">w</code> of type <code lang="scala">Int</code>.</li>
<li>if <code lang="scala">compare(x, y) == z</code> and <code lang="scala">lteq(y, w) == v</code> and <code lang="scala">Math.signum(z) &gt;= 0</code> and <code lang="scala">Math.signum(v) &gt;= 0</code> then<br />
 <code lang="scala">compare(x, w) == u</code> and <code lang="scala">Math.signum(z + v) == Math.signum(u)</code>,<br />
 for any <code lang="scala">x</code>, <code lang="scala">y</code>, and <code lang="scala">w</code> of type <code lang="scala">T</code> and <code lang="scala">z</code>, <code lang="scala">v</code>, and <code lang="scala">u</code> of type <code lang="scalal">Int</code>.</li>
</ul>
<p>Where <code lang="scala">Math.signum</code> returns <code lang="scala">-1</code> if its input is negative, <code lang="scala">0</code> if its input is <code lang="scala">0</code>, and <code lang="scala">1</code> if its input is positive.</p>
<p>The first property is clearly reflexivity.  I call the third property transitivity.  I am not sure what to call the second property. I do not think a notion of totality is required because it is assumed you will always get an integer back from <code lang="scala">compare</code> rather than it throwing an exception or going into an infinite loop.  </p>
<p>It would probably be a good exercise to prove that given these properties on <code lang="scala">compare</code> hold if and only if <code lang="scala">lteq</code> (defined above in terms of <code lang="scala">compare</code>) has all the normal properties of a total ordering.</p>
]]></content:encoded>
			<wfw:commentRss>http://existentialtype.net/2008/04/09/an-unusual-definition-of-total-ordering/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Research update</title>
		<link>http://existentialtype.net/2008/02/26/research-update-2/</link>
		<comments>http://existentialtype.net/2008/02/26/research-update-2/#comments</comments>
		<pubDate>Tue, 26 Feb 2008 22:05:49 +0000</pubDate>
		<dc:creator>washburn</dc:creator>
				<category><![CDATA[hacking]]></category>
		<category><![CDATA[papers]]></category>
		<category><![CDATA[research]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[types]]></category>
		<category><![CDATA[featherweight scala]]></category>
		<category><![CDATA[generalizing parametricity]]></category>
		<category><![CDATA[lmcs]]></category>
		<category><![CDATA[malicious coding]]></category>
		<category><![CDATA[scala]]></category>

		<guid isPermaLink="false">http://existentialtype.net/2008/02/26/research-update-2/</guid>
		<description><![CDATA[I finished a draft of "Generalizing Parametricity Using Information-flow" for LMCS this past weekend. That should leave me with fewer distractions to work on something for ICFP. My work on Featherweight Scala is moving along, sometimes more slowly than others. Other than the issues with singletons I have already discussed, one problem with the original [...]]]></description>
			<content:encoded><![CDATA[<p>I finished a draft of "Generalizing Parametricity Using Information-flow" for <a href="http://www.lmcs-online.org/">LMCS</a> this past weekend.  That should leave me with fewer distractions to work on something for <a href="http://www.icfpconference.org/icfp2008/">ICFP</a>.</p>
<p>My work on Featherweight Scala is moving along, sometimes more slowly than others.  Other than the <a href="http://existentialtype.net/2008/01/30/more-notes-on-featherweight-scala/">issues with singletons</a> I have already discussed, one problem with the original definition of Featherweight Scala is that it did not truly define a subset of Scala proper – that is, there were many valid Featherweight Scala programs that were not valid Scala programs.</p>
<p>So I have been working on trying to get Featherweight Scala to be as close to a subset of Scala proper as is possible without making it far too complicated to be a useful core calculus.  Some of this has involved changing the definition of Featherweight Scala.  Some of this has involved lobbying for changes to Scala proper to make it more uniform (so far I've succeed with extending traits to allow value declarations to be overridden).</p>
<p>Through the whole process I've also been spending a lot of time typing things into the Scala interpreter to figure out how Scala proper treats them.  For better or worse, I've actually managed to uncover a fair number of bugs in Scala proper doing this.  I've almost reached the point where I treat it as a bit of a game: can I from thinking about the properties of the Scala type system come up with some corner case that will exhibit an unsoundness in the language (a <code>ClassCastException</code>, a <code>NoSuchMethodException</code>, etc.), or at least crash the compiler?</p>
<p>Last week I came up with a pretty nice one where I used the fact that Scala should not allow inheritance from singleton types to launder types in an unsafe fashion (now fixed in trunk!).  Prior to that I came up with something fun where you could trick the compiler into letting you inherit from <code>Nothing</code> (which is supposed to be the bottom of the subtyping hierarchy). Today I got to thinking about Scala's requirements that paths in singleton types must be stable – all components of a path must be immutable.  So for example in</p>
<blockquote>
<pre class="scala">&nbsp;
<a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">var</span></a> x <span style="color: #a00000;">=</span> <span style="color: #f78811;">3</span>
<a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">val</span></a> y <span style="color: #a00000;">:</span> x.<a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">type</span></a> <span style="color: #a00000;">=</span> x <span style="color: #808080; font-style: italic;">// ill-typed</span></pre>
</blockquote>
<p>The path <code>x</code> is not stable because <code>x</code> is a mutable variable. However, Scala does allow lazy value declarations to be stable.</p>
<blockquote>
<pre class="scala">&nbsp;
<a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">var</span></a> x <span style="color: #a00000;">=</span> <span style="color: #f78811;">3</span>
<a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">lazy</span></a> <a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">val</span></a> y <span style="color: #a00000;">=</span> x
<a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">val</span></a> z <span style="color: #a00000;">:</span> y.<a href="http://www.scala-lang.org/docu/files/ScalaReference.pdf"><span style="color: #009900;">type</span></a> <span style="color: #a00000;">=</span> y <span style="color: #808080; font-style: italic;">// allowed, at present</span></pre>
</blockquote>
<p>Note that <code>y</code> is not evaluated until it is first needed, and in this case its evaluation involves a mutable reference.  Furthermore, add into the mix that Scala also provides call-by-name method arguments (lazy values are call-by-need).  So I started riffing on the idea of whether I could violate stability by changing the mutable reference between the definition of the lazy value, or a call-by-name argument, and its use.  In retrospect, I am leaning at present towards the belief that there is no way this should be exploitable from a theoretical standpoint.  That does not mean that the implementation is necessarily in alignment with theory, however.  I did manage to hit upon a combination in my experiments that resulted in a <code>NoSuchMethodException</code>, so the exercise was not a complete letdown.</p>
<p>I should point out that these things do not really reflect on the quality of the Scala language as whole.  It is a rich language that does not yet have a complete formal model, and as such, in the implementation process it can be easy to overlook some particularly perverse abuses of the language.</p>
]]></content:encoded>
			<wfw:commentRss>http://existentialtype.net/2008/02/26/research-update-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tablet computing</title>
		<link>http://existentialtype.net/2008/01/15/tablet-computing/</link>
		<comments>http://existentialtype.net/2008/01/15/tablet-computing/#comments</comments>
		<pubDate>Tue, 15 Jan 2008 11:02:10 +0000</pubDate>
		<dc:creator>washburn</dc:creator>
				<category><![CDATA[hardware]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[cellwriter]]></category>
		<category><![CDATA[rsi]]></category>
		<category><![CDATA[tablet]]></category>
		<category><![CDATA[thinkpad]]></category>
		<category><![CDATA[vista]]></category>
		<category><![CDATA[vmware]]></category>

		<guid isPermaLink="false">http://existentialtype.net/2008/01/15/tablet-computing/</guid>
		<description><![CDATA[Writing about RSI reminded me that I had never gotten around to talking about the ThinkPad X61 tablet I purchased at the beginning of August. It is a pretty solid when used as a laptop. As far as being a tablet goes, it works reasonably well in that domain too, with some exceptions. Firstly, for [...]]]></description>
			<content:encoded><![CDATA[<p>Writing about RSI reminded me that I had never gotten around to talking about the <a href="http://shop.lenovo.com/us/notebooks/thinkpad/x-series">ThinkPad X61</a> tablet I purchased at the beginning of August.  It is a pretty solid when used as a laptop.  </p>
<p>As far as being a tablet goes, it works reasonably well in that domain too, with some exceptions.  Firstly, for now if you want to use the tablet capabilities to their fullest, you need to run Windows Vista.  The tablet is supposed to be supported under Linux, but there is really only one program that supports handwriting recognition program available, <a href="http://risujin.org/cellwriter/">Cellwriter</a>.  It looks promising, particularly because it can be trained to generate any Unicode glyph &ndash; with Vista you are limited to the system's configured language.  However, I do not think it would be difficult for Gnome or KDE to catch up in this area if they put a little effort into it.  </p>
<p>My initial solution to this was that I would just run Linux under VMWare.  Except I soon found that while I can use the tablet as a mouse, VMWare will not accept the input events the handwriting recognition subsystem generates.  When I filed this as a bug they did not seem to think this was a problem.  </p>
<p>While working with standard Windows applications, anything with a input field can accept handwriting recognition input.  I almost wrote my entire defense presentation this way, but near the end I gave in and used the keyboard to do most of the last minute tweaking. </p>
<p>Of course, there is the question of whether writing by hand is any easier on my wrists than typing.  It is difficult to say, for one, it becomes basically impossible to use emacs, unless you can do everything from pull-down menus, because of the chording necessary to activate some functionality.  And it is definitely slower than typing, even with practice I expect.  However, part of the problem could perhaps be resolved by rethinking various applications with tablets in mind.  </p>
]]></content:encoded>
			<wfw:commentRss>http://existentialtype.net/2008/01/15/tablet-computing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Research update</title>
		<link>http://existentialtype.net/2008/01/14/research-update/</link>
		<comments>http://existentialtype.net/2008/01/14/research-update/#comments</comments>
		<pubDate>Mon, 14 Jan 2008 21:04:42 +0000</pubDate>
		<dc:creator>washburn</dc:creator>
				<category><![CDATA[hacking]]></category>
		<category><![CDATA[research]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[types]]></category>
		<category><![CDATA[coq]]></category>
		<category><![CDATA[effects]]></category>
		<category><![CDATA[featherweight scala]]></category>
		<category><![CDATA[generics]]></category>
		<category><![CDATA[jvm]]></category>
		<category><![CDATA[purity]]></category>
		<category><![CDATA[rsi]]></category>
		<category><![CDATA[virtual classes]]></category>

		<guid isPermaLink="false">http://existentialtype.net/2008/01/14/research-update/</guid>
		<description><![CDATA[I have been making reasonably steady progress on my formalization of Featherweight Scala in Coq. I have just about seven hundred lines of definitions, with only few more things to make explicit. At that point I should be ready to start on actually proving progress and preservation. I volunteered to triage issues submitted to the [...]]]></description>
			<content:encoded><![CDATA[<p>I have been making reasonably steady progress on my formalization of Featherweight Scala in Coq.  I have just about seven hundred lines of definitions, with only few more things to make explicit.  At that point I should be ready to start on actually proving progress and preservation.</p>
<p>I volunteered to triage issues submitted to the Scala bugtracking system this month, so that has been taking a little bit of my time. Mostly this just involves checking that what was submit is truly a bug and reproducible, before assigning it to the relevant person.</p>
<p>I am also responsible for the interpreter and the ScalaDoc, so I have also spent the time fixing a few bugs that have shown up in the interpreter.  The big one of the past week is that for 2.6.2 the plan is to finally interoperate with Java generics.  As a consequence, the compiler now defaults to generating class files in the format used in version 1.5 of the JVM and above.  However, this broke the nightly tests run against the 1.4 JVM.  The interpreter would compile and run fine until it tried to load one of the class files itself had compiled, which had an incompatible version number.  So I added a check that if the interpreter is running on a pre-1.5 JVM, to force it to generate compatible class files.</p>
<p>An undergrad e-mailed me to ask about working on the <a href="http://lamp.epfl.ch/teaching/projects/index.html.en#literate">Literate Scala semester project</a> that I had posted.  I met with him briefly last week for mostly administrative purposes.  That should be interesting.</p>
<p>I should be moving forward on the implementation of virtual classes, but I have been avoiding it because I am not yet sure how to best modify the AST to represent them.  I will hopefully have chance to discuss it with Martin this week.</p>
<p>I have also been spending time thinking about the next major project, an effect system for Scala.  I have been thinking hard about how to add one while still maintaining reasonable backward compatibility and so that it is not exceedingly verbose.  It is a very difficult problem.  Furthermore, one of the most widely used effect systems that exists in programming languages, Java's <a href="http://java.sun.com/docs/books/tutorial/essential/exceptions/declaring.html">throws clauses</a>, is generally reviled by programmers.  One thought I had was that maybe a whiz-bang effect system with effect polymorphism, a rich language of effects, and hooks for adding user defined effects is just overkill.  Maybe programmers would be happy with being able to write an annotation like <code>@pure</code> on their methods and closures, and leave it at that.  Enforcing purity would not be too difficult I think (ignoring the well known problem of the termination effect), and be much easier for programmers to reason about.</p>
<p>My wrists have also started acting up again, so I am not entirely sure how to deal with that, yet continue pushing my current research projects forward.  It has been suggested to me to look into voice recognition software, but I am not sure how compatible that would be with my current workflow.  Not to mention that I can only imagine how much it would annoy the people in the adjoining offices given that they have already expressed displeasure at all the beeping caused by emacs on my desktop computer.</p>
]]></content:encoded>
			<wfw:commentRss>http://existentialtype.net/2008/01/14/research-update/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

