<?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: Type safety and singletons</title>
	<atom:link href="http://existentialtype.net/2008/01/25/type-safety-and-singletons/feed/" rel="self" type="application/rss+xml" />
	<link>http://existentialtype.net/2008/01/25/type-safety-and-singletons/</link>
	<description>For People Who Like Type and Types</description>
	<pubDate>Tue, 06 Jan 2009 03:29:44 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: washburn</title>
		<link>http://existentialtype.net/2008/01/25/type-safety-and-singletons/comment-page-1/#comment-21355</link>
		<dc:creator>washburn</dc:creator>
		<pubDate>Sun, 27 Jan 2008 15:16:52 +0000</pubDate>
		<guid isPermaLink="false">http://existentialtype.net/2008/01/25/type-safety-and-singletons/#comment-21355</guid>
		<description>@Andrew: Thanks, I'll check that out and see if there is something useful in that work.</description>
		<content:encoded><![CDATA[<p>@Andrew: Thanks, I&#8217;ll check that out and see if there is something useful in that work.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andrew</title>
		<link>http://existentialtype.net/2008/01/25/type-safety-and-singletons/comment-page-1/#comment-21325</link>
		<dc:creator>Andrew</dc:creator>
		<pubDate>Sat, 26 Jan 2008 02:04:35 +0000</pubDate>
		<guid isPermaLink="false">http://existentialtype.net/2008/01/25/type-safety-and-singletons/#comment-21325</guid>
		<description>That also reminds me of dot notation.  Though I don't remember how people usually avoid that problem there.</description>
		<content:encoded><![CDATA[<p>That also reminds me of dot notation.  Though I don&#8217;t remember how people usually avoid that problem there.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: washburn</title>
		<link>http://existentialtype.net/2008/01/25/type-safety-and-singletons/comment-page-1/#comment-21323</link>
		<dc:creator>washburn</dc:creator>
		<pubDate>Fri, 25 Jan 2008 15:52:08 +0000</pubDate>
		<guid isPermaLink="false">http://existentialtype.net/2008/01/25/type-safety-and-singletons/#comment-21323</guid>
		<description>@Dan: Featherweight Scala does not presently have a notion of type equality, it just has type subsumption.  I would hope that type equivalence can be defined in terms of type subsumption, but it would be a good idea to verify that it will truly form an equivalence relation.

As for singletons inducing equalities, I would assume you mean "are there type subsumption rules concerning singletons"?  Yes, there are two rules and they are quite similar to the ones that can be found in section 2.2 of "A Type System for Higher-Order Modules".  The rules I am using currently can be found in some &lt;a href="http://lamp.epfl.ch/teaching/foundations_of_software/docs/week13.pdf" rel="nofollow"&gt;slides&lt;/a&gt; from a lecture Martin recently gave.

In any event, I believe I have found a solution based upon how singletons were handled in the &#957;Obj calculus.  However, it will require changing the operational semantics from what is given in the paper &lt;a href="http://infoscience.epfl.ch/search?recid=95716&#038;ln=en" rel="nofollow"&gt;A Core Calculus for Scala Type Checking&lt;/a&gt;.</description>
		<content:encoded><![CDATA[<p>@Dan: Featherweight Scala does not presently have a notion of type equality, it just has type subsumption.  I would hope that type equivalence can be defined in terms of type subsumption, but it would be a good idea to verify that it will truly form an equivalence relation.</p>
<p>As for singletons inducing equalities, I would assume you mean &#8220;are there type subsumption rules concerning singletons&#8221;?  Yes, there are two rules and they are quite similar to the ones that can be found in section 2.2 of &#8220;A Type System for Higher-Order Modules&#8221;.  The rules I am using currently can be found in some <a href="http://lamp.epfl.ch/teaching/foundations_of_software/docs/week13.pdf" rel="nofollow">slides</a> from a lecture Martin recently gave.</p>
<p>In any event, I believe I have found a solution based upon how singletons were handled in the &nu;Obj calculus.  However, it will require changing the operational semantics from what is given in the paper <a href="http://infoscience.epfl.ch/search?recid=95716&#038;ln=en" rel="nofollow">A Core Calculus for Scala Type Checking</a>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dan Licata</title>
		<link>http://existentialtype.net/2008/01/25/type-safety-and-singletons/comment-page-1/#comment-21322</link>
		<dc:creator>Dan Licata</dc:creator>
		<pubDate>Fri, 25 Jan 2008 15:42:30 +0000</pubDate>
		<guid isPermaLink="false">http://existentialtype.net/2008/01/25/type-safety-and-singletons/#comment-21322</guid>
		<description>Hi Geoff,
I haven't looked at the path-dependent types in Scala, but here's what happens with singletons in ML: the problem isn't so much the singleton introduction rule at the constructor level, but the elimination rule, which induces an equality (see Stone-Harper for details).  The reason is that you then have a non-syntax-directed constructor equality (notated C1 = C2 :: K), with a rule that says equal constructors are equal classifiers:

M : A   A = B :: type
---------------------- 
     M : B

This rule is a problem for type safety because now all of your inversion and canonical forms lemmas go out the window.  About 2/3s of the Twelf formalization of the SML IL is devoted to solving this problem; i.e., to proving that int isn't equal to bool.  The way you do this is to give an alternate algorithmic version of equality for which the necessary inversions are obvious.  An alternative is to define equality algorithmically to begin with, but then you often need to show that most of the declarative rules (e.g. transitivity) are admissible for your proofs anyway.

How does type equality work in Scala?  Does a singleton induce an equality?</description>
		<content:encoded><![CDATA[<p>Hi Geoff,<br />
I haven&#8217;t looked at the path-dependent types in Scala, but here&#8217;s what happens with singletons in ML: the problem isn&#8217;t so much the singleton introduction rule at the constructor level, but the elimination rule, which induces an equality (see Stone-Harper for details).  The reason is that you then have a non-syntax-directed constructor equality (notated C1 = C2 :: K), with a rule that says equal constructors are equal classifiers:</p>
<p>M : A   A = B :: type<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
     M : B</p>
<p>This rule is a problem for type safety because now all of your inversion and canonical forms lemmas go out the window.  About 2/3s of the Twelf formalization of the SML IL is devoted to solving this problem; i.e., to proving that int isn&#8217;t equal to bool.  The way you do this is to give an alternate algorithmic version of equality for which the necessary inversions are obvious.  An alternative is to define equality algorithmically to begin with, but then you often need to show that most of the declarative rules (e.g. transitivity) are admissible for your proofs anyway.</p>
<p>How does type equality work in Scala?  Does a singleton induce an equality?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
