<?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: Minor revelation about Scala existential types</title>
	<atom:link href="http://www.drmaciver.com/2008/01/minor-revelation-about-scala-existential-types/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.drmaciver.com/2008/01/minor-revelation-about-scala-existential-types/</link>
	<description></description>
	<lastBuildDate>Wed, 10 Feb 2010 18:19:37 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Marius</title>
		<link>http://www.drmaciver.com/2008/01/minor-revelation-about-scala-existential-types/comment-page-1/#comment-124</link>
		<dc:creator>Marius</dc:creator>
		<pubDate>Sat, 19 Jan 2008 16:23:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.drmaciver.com/wordpress/?p=80#comment-124</guid>
		<description>doing a different approach:&lt;br/&gt;&lt;br/&gt;having:&lt;br/&gt;&lt;br/&gt;class C[T](x: T*) &lt;br/&gt;&lt;br/&gt;and &lt;br/&gt;def foo(xs : C[C[T forSome {type T;}]]) = { }&lt;br/&gt;&lt;br/&gt;foo(new C(new C(&quot;foo&quot;), new C(1)));&lt;br/&gt;&lt;br/&gt;compiles correctly&lt;br/&gt;&lt;br/&gt;whereas &lt;br/&gt;&lt;br/&gt;having:&lt;br/&gt;&lt;br/&gt;def foo[T](xs : C[C[T]]) = { }&lt;br/&gt;&lt;br/&gt;does not compile.&lt;br/&gt;&lt;br/&gt;so you&#039;re right the two declarations are not the same (just  beautiful) but still I&#039;m not clear why the Array&#039;s example does not compile. Arrays apply method is parameterized like [A &lt;: Any] but obviously a type T is ultimately an Any.</description>
		<content:encoded><![CDATA[<p>doing a different approach:</p>
<p>having:</p>
<p>class C[T](x: T*) </p>
<p>and <br />def foo(xs : C[C[T forSome {type T;}]]) = { }</p>
<p>foo(new C(new C(&#8220;foo&#8221;), new C(1)));</p>
<p>compiles correctly</p>
<p>whereas </p>
<p>having:</p>
<p>def foo[T](xs : C[C[T]]) = { }</p>
<p>does not compile.</p>
<p>so you&#8217;re right the two declarations are not the same (just  beautiful) but still I&#8217;m not clear why the Array&#8217;s example does not compile. Arrays apply method is parameterized like [A <: Any] but obviously a type T is ultimately an Any.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Marius</title>
		<link>http://www.drmaciver.com/2008/01/minor-revelation-about-scala-existential-types/comment-page-1/#comment-123</link>
		<dc:creator>Marius</dc:creator>
		<pubDate>Sat, 19 Jan 2008 16:12:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.drmaciver.com/wordpress/?p=80#comment-123</guid>
		<description>One more thing:&lt;br/&gt;&lt;br/&gt;having&lt;br/&gt;&lt;br/&gt;    val t: Array[Array[T forSome {type T}]] = Array(Array(&quot;foo&quot;), Array(&quot;1&quot;))&lt;br/&gt;&lt;br/&gt;yields the same compiler error whereas:&lt;br/&gt;&lt;br/&gt;    val t: Array[Array[T forSome {type T &lt;: String}]] = Array(Array(&quot;foo&quot;), Array(&quot;1&quot;))&lt;br/&gt;&lt;br/&gt;is a correct declaration.&lt;br/&gt;&lt;br/&gt;... so far I could not use existential types to abstract different types. Am I doing something wrong? &lt;br/&gt;&lt;br/&gt;P.S. - there is atypoe above I declared foo but invoked foo1. Just ignore this</description>
		<content:encoded><![CDATA[<p>One more thing:</p>
<p>having</p>
<p>    val t: Array[Array[T forSome {type T}]] = Array(Array(&#8220;foo&#8221;), Array(&#8220;1&#8243;))</p>
<p>yields the same compiler error whereas:</p>
<p>    val t: Array[Array[T forSome {type T < : String}]] = Array(Array(&#8220;foo&#8221;), Array(&#8220;1&#8243;))<br/><br />is a correct declaration.</p>
<p>&#8230; so far I could not use existential types to abstract different types. Am I doing something wrong? </p>
<p>P.S. &#8211; there is atypoe above I declared foo but invoked foo1. Just ignore this</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Marius</title>
		<link>http://www.drmaciver.com/2008/01/minor-revelation-about-scala-existential-types/comment-page-1/#comment-122</link>
		<dc:creator>Marius</dc:creator>
		<pubDate>Sat, 19 Jan 2008 16:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.drmaciver.com/wordpress/?p=80#comment-122</guid>
		<description>having :&lt;br/&gt;&lt;br/&gt;  def foo(xss : Array[Array[T forSome { type T; }]]) = for(xs &lt;- xss) {&lt;br/&gt;    xs(0) = xs(1);&lt;br/&gt;  }&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;attempting to call it like:&lt;br/&gt;foo1(Array(Array(&quot;foo&quot;), Array(3)));&lt;br/&gt;&lt;br/&gt;yields the following compiler error :&lt;br/&gt;&lt;br/&gt;&quot;inferred type arguments [T forSome { type T }] do not conform to method apply&#039;s type parameter bounds [A &lt;: AnyRef]&quot;&lt;br/&gt;&lt;br/&gt;similarly:&lt;br/&gt;&lt;br/&gt;val t: Array[Array[T forSome { type T; }]] = Array(Array(&quot;foo&quot;), Array(1))&lt;br/&gt;&lt;br/&gt;is not a valid declaration. &lt;br/&gt;&lt;br/&gt;(I&#039;m using Scala 2.6.1)&lt;br/&gt;&lt;br/&gt;Any thoughts?</description>
		<content:encoded><![CDATA[<p>having :</p>
<p>  def foo(xss : Array[Array[T forSome { type T; }]]) = for(xs < - xss) {<br/>    xs(0) = xs(1);<br />  }</p>
<p>attempting to call it like:<br />foo1(Array(Array(&#8220;foo&#8221;), Array(3)));</p>
<p>yields the following compiler error :</p>
<p>&#8220;inferred type arguments [T forSome { type T }] do not conform to method apply&#8217;s type parameter bounds [A < : AnyRef]&#8220;<br/><br />similarly:</p>
<p>val t: Array[Array[T forSome { type T; }]] = Array(Array(&#8220;foo&#8221;), Array(1))</p>
<p>is not a valid declaration. </p>
<p>(I&#8217;m using Scala 2.6.1)</p>
<p>Any thoughts?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David R. MacIver</title>
		<link>http://www.drmaciver.com/2008/01/minor-revelation-about-scala-existential-types/comment-page-1/#comment-121</link>
		<dc:creator>David R. MacIver</dc:creator>
		<pubDate>Fri, 18 Jan 2008 22:57:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.drmaciver.com/wordpress/?p=80#comment-121</guid>
		<description>Those two don&#039;t do the same thing though. &lt;br/&gt;&lt;br/&gt;Array(Array(&quot;foo&quot;), Array(1)) is a perfectly valid Array[Array[T forSome { type T; }]], but it isn&#039;t an Array[Array[T]] for any given T. The point is that T can assume different values for different members of the outer array.</description>
		<content:encoded><![CDATA[<p>Those two don&#8217;t do the same thing though. </p>
<p>Array(Array(&#8220;foo&#8221;), Array(1)) is a perfectly valid Array[Array[T forSome { type T; }]], but it isn&#8217;t an Array[Array[T]] for any given T. The point is that T can assume different values for different members of the outer array.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Marius</title>
		<link>http://www.drmaciver.com/2008/01/minor-revelation-about-scala-existential-types/comment-page-1/#comment-120</link>
		<dc:creator>Marius</dc:creator>
		<pubDate>Fri, 18 Jan 2008 21:56:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.drmaciver.com/wordpress/?p=80#comment-120</guid>
		<description>So where is the revelation?&lt;br/&gt;&lt;br/&gt;  def foo[T](xss : Array[Array[T]]) = for(xs &lt;- xss) {&lt;br/&gt;    xs(0) = xs(1);&lt;br/&gt;  }&lt;br/&gt;&lt;br/&gt;seems to be equivalent to your example. So why using an existential type in your example?&lt;br/&gt;&lt;br/&gt;In Java one can capture the wildcard with a T.&lt;br/&gt;&lt;br/&gt;P.S.&lt;br/&gt;I also like Scala very much and I&#039;d like to have a better understanding of existential types although so far it seems to me that their usefulness is related with packing types without using inference of the polymorphic method</description>
		<content:encoded><![CDATA[<p>So where is the revelation?</p>
<p>  def foo[T](xss : Array[Array[T]]) = for(xs < - xss) {<br/>    xs(0) = xs(1);<br />  }</p>
<p>seems to be equivalent to your example. So why using an existential type in your example?</p>
<p>In Java one can capture the wildcard with a T.</p>
<p>P.S.<br />I also like Scala very much and I&#8217;d like to have a better understanding of existential types although so far it seems to me that their usefulness is related with packing types without using inference of the polymorphic method</p>
]]></content:encoded>
	</item>
</channel>
</rss>
