<?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: Literally dependent types</title>
	<atom:link href="http://existentialtype.net/2008/07/21/literally-dependent-types/feed/" rel="self" type="application/rss+xml" />
	<link>http://existentialtype.net/2008/07/21/literally-dependent-types/</link>
	<description>For People Who Like Type and Types</description>
	<pubDate>Tue, 06 Jan 2009 09:08:46 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: David R. MacIver</title>
		<link>http://existentialtype.net/2008/07/21/literally-dependent-types/comment-page-1/#comment-23457</link>
		<dc:creator>David R. MacIver</dc:creator>
		<pubDate>Tue, 22 Jul 2008 09:19:05 +0000</pubDate>
		<guid isPermaLink="false">http://existentialtype.net/?p=264#comment-23457</guid>
		<description>Yeah. I thought I could fake union types with some appropriate combination of implicits to handle embeddings, but after some experimentation I can't appear to coerce the type checker into resolving the embeddings correctly, so the enumerations idea doesn't work after all. Sorry.</description>
		<content:encoded><![CDATA[<p>Yeah. I thought I could fake union types with some appropriate combination of implicits to handle embeddings, but after some experimentation I can&#8217;t appear to coerce the type checker into resolving the embeddings correctly, so the enumerations idea doesn&#8217;t work after all. Sorry.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: washburn</title>
		<link>http://existentialtype.net/2008/07/21/literally-dependent-types/comment-page-1/#comment-23453</link>
		<dc:creator>washburn</dc:creator>
		<pubDate>Tue, 22 Jul 2008 07:51:05 +0000</pubDate>
		<guid isPermaLink="false">http://existentialtype.net/?p=264#comment-23453</guid>
		<description>@David: No, &lt;code&gt;def foo&lt;/code&gt; will get type &lt;code&gt;String&lt;/code&gt;.  For better or worse, Scala already does not infer the the most specific type in many cases.  In fact, in most of the time it will throw away singleton types and replace them with their underlying type, even if you try adding more annotations than is desirable (see &lt;a href="https://lampsvn.epfl.ch/trac/scala/ticket/837" rel="nofollow"&gt;ticket #837&lt;/a&gt;).  

I had briefly thought about the enumeration example, but I couldn't see a good way to make it work without union types.  We could potentially add union types in the future, but the theory needs to be verified first.</description>
		<content:encoded><![CDATA[<p>@David: No, <code>def foo</code> will get type <code>String</code>.  For better or worse, Scala already does not infer the the most specific type in many cases.  In fact, in most of the time it will throw away singleton types and replace them with their underlying type, even if you try adding more annotations than is desirable (see <a href="https://lampsvn.epfl.ch/trac/scala/ticket/837" rel="nofollow">ticket #837</a>).  </p>
<p>I had briefly thought about the enumeration example, but I couldn&#8217;t see a good way to make it work without union types.  We could potentially add union types in the future, but the theory needs to be verified first.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David R. MacIver</title>
		<link>http://existentialtype.net/2008/07/21/literally-dependent-types/comment-page-1/#comment-23451</link>
		<dc:creator>David R. MacIver</dc:creator>
		<pubDate>Tue, 22 Jul 2008 00:25:04 +0000</pubDate>
		<guid isPermaLink="false">http://existentialtype.net/?p=264#comment-23451</guid>
		<description>So I was tinkering with the idea and trying to come up with a use for it. I've been struggling a bit - it doesn't look like a very useful feature on its own (though it looks like it leads in some interesting directions).

One thing that occurred to me for making this more useful is if the value of the singleton type were available as an implicit value. I suspect this causes problems though, because it's then also available as an implicit value of the supertype. An example use case was the ranged types implementation I was tinkering with a while ago. If the values were available implicitly then you could also make a range object available implicitly. It's a bit of a stretch though.

Another thing I was wondering about: How will this interact with the type inferencer? e.g. if I write 

def foo = "foo";

presumably foo will be inferred as returning a String, not a "foo".type? How does this work with the normal approach of always inferring the most specific type? Otherwise you're going to have to use a lot more type annotations than you used to (for cases where foo should be overrideable, or where it's actually a var)

The other part of the reason I ask is that sometimes you'd actively want the most specific type to be inferred. e.g. I was wondering about using this as an alternative to Enumeration, so you could define something like 

val Months = "January" &#124; "February" &#124; etc. 

and statically check membership of string literals. But this becomes really crappy to use if the literals are inferred as type String as you end up having to provide all the type parameters (though this could also work not too badly with the implicits suggestion)

Anyway, just some random thoughts.</description>
		<content:encoded><![CDATA[<p>So I was tinkering with the idea and trying to come up with a use for it. I&#8217;ve been struggling a bit - it doesn&#8217;t look like a very useful feature on its own (though it looks like it leads in some interesting directions).</p>
<p>One thing that occurred to me for making this more useful is if the value of the singleton type were available as an implicit value. I suspect this causes problems though, because it&#8217;s then also available as an implicit value of the supertype. An example use case was the ranged types implementation I was tinkering with a while ago. If the values were available implicitly then you could also make a range object available implicitly. It&#8217;s a bit of a stretch though.</p>
<p>Another thing I was wondering about: How will this interact with the type inferencer? e.g. if I write </p>
<p>def foo = &#8220;foo&#8221;;</p>
<p>presumably foo will be inferred as returning a String, not a &#8220;foo&#8221;.type? How does this work with the normal approach of always inferring the most specific type? Otherwise you&#8217;re going to have to use a lot more type annotations than you used to (for cases where foo should be overrideable, or where it&#8217;s actually a var)</p>
<p>The other part of the reason I ask is that sometimes you&#8217;d actively want the most specific type to be inferred. e.g. I was wondering about using this as an alternative to Enumeration, so you could define something like </p>
<p>val Months = &#8220;January&#8221; | &#8220;February&#8221; | etc. </p>
<p>and statically check membership of string literals. But this becomes really crappy to use if the literals are inferred as type String as you end up having to provide all the type parameters (though this could also work not too badly with the implicits suggestion)</p>
<p>Anyway, just some random thoughts.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
