<?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: Groovy type crazyness</title>
	<atom:link href="http://tiago.org/cc/2009/01/05/groovy-type-crazyness/feed/" rel="self" type="application/rss+xml" />
	<link>http://tiago.org/cc/2009/01/05/groovy-type-crazyness/</link>
	<description>Software engineering in a computational biology environment</description>
	<lastBuildDate>Mon, 24 Oct 2011 21:36:40 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: tiago</title>
		<link>http://tiago.org/cc/2009/01/05/groovy-type-crazyness/comment-page-1/#comment-462</link>
		<dc:creator>tiago</dc:creator>
		<pubDate>Tue, 06 Jan 2009 16:11:35 +0000</pubDate>
		<guid isPermaLink="false">http://tiago.org/cc/?p=56#comment-462</guid>
		<description>Aaron: Thanks for the comment. I guess I was lazy. Equal semantics was more or less obviously the source of the problem and I could have dig deeper myself.

James: I think we are entering the realm of the subjective here. I mean, for me, very personally, metaprogramming is a must have. For me generics are the worse of Java. Your mileage may vary and we might have a lot of interesting discussions around these, but, at the end, personal choices dictate what we find acceptable/desirable.</description>
		<content:encoded><![CDATA[<p>Aaron: Thanks for the comment. I guess I was lazy. Equal semantics was more or less obviously the source of the problem and I could have dig deeper myself.</p>
<p>James: I think we are entering the realm of the subjective here. I mean, for me, very personally, metaprogramming is a must have. For me generics are the worse of Java. Your mileage may vary and we might have a lot of interesting discussions around these, but, at the end, personal choices dictate what we find acceptable/desirable.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Aaron Tuwhangai</title>
		<link>http://tiago.org/cc/2009/01/05/groovy-type-crazyness/comment-page-1/#comment-461</link>
		<dc:creator>Aaron Tuwhangai</dc:creator>
		<pubDate>Tue, 06 Jan 2009 05:54:51 +0000</pubDate>
		<guid isPermaLink="false">http://tiago.org/cc/?p=56#comment-461</guid>
		<description>The == operator coerces its arguments to the same type before comparing them, so &quot;0.1 == 0.1D&quot; is coerced to mean &quot;0.1 == 0.1&quot;.  

The reason that &quot;0.1 in [0.1D]&quot; returns false is that &quot;0.1.equals(0.1D)&quot; also returns false.  This correctly follows the Java rules for equals() rather than being a Groovy thing.</description>
		<content:encoded><![CDATA[<p>The == operator coerces its arguments to the same type before comparing them, so &#8220;0.1 == 0.1D&#8221; is coerced to mean &#8220;0.1 == 0.1&#8243;.  </p>
<p>The reason that &#8220;0.1 in [0.1D]&#8221; returns false is that &#8220;0.1.equals(0.1D)&#8221; also returns false.  This correctly follows the Java rules for equals() rather than being a Groovy thing.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: James Iry</title>
		<link>http://tiago.org/cc/2009/01/05/groovy-type-crazyness/comment-page-1/#comment-460</link>
		<dc:creator>James Iry</dc:creator>
		<pubDate>Tue, 06 Jan 2009 03:45:19 +0000</pubDate>
		<guid isPermaLink="false">http://tiago.org/cc/?p=56#comment-460</guid>
		<description>So you don&#039;t like Scala because its inference isn&#039;t as complete as Caml, but you like to use explicit types in Groovy? 

There have been some updates to dynamic metaprogramming in Scala via something called Manifests which are, in part, a way to reify generic type parameters. But any serious metaprogramming that Scala gets will likely be syntactic metaprogramming a&#039;la template Haskell or Nemerle.  Don&#039;t expect the dynamic metaprogramming found in Ruby and Groovy.  

Generics aren&#039;t the worst thing in Java by a long shot.  Not even erasure is (after all, Caml&#039;s type system is implemented entirely with erasure).</description>
		<content:encoded><![CDATA[<p>So you don&#8217;t like Scala because its inference isn&#8217;t as complete as Caml, but you like to use explicit types in Groovy? </p>
<p>There have been some updates to dynamic metaprogramming in Scala via something called Manifests which are, in part, a way to reify generic type parameters. But any serious metaprogramming that Scala gets will likely be syntactic metaprogramming a&#8217;la template Haskell or Nemerle.  Don&#8217;t expect the dynamic metaprogramming found in Ruby and Groovy.  </p>
<p>Generics aren&#8217;t the worst thing in Java by a long shot.  Not even erasure is (after all, Caml&#8217;s type system is implemented entirely with erasure).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tiago</title>
		<link>http://tiago.org/cc/2009/01/05/groovy-type-crazyness/comment-page-1/#comment-458</link>
		<dc:creator>tiago</dc:creator>
		<pubDate>Mon, 05 Jan 2009 23:14:11 +0000</pubDate>
		<guid isPermaLink="false">http://tiago.org/cc/?p=56#comment-458</guid>
		<description>James,

First, thanks for your insightful comments. I have to say I have started with Scala (and migrated to Groovy). I guess am a metaprogramming freak. A summary of my reasons can be found &lt;a href=&quot;http://tiago.org/ps/2008/02/24/groovyscalarubypython-on-jvm/&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;. It would be fantastic to know that there are updates on the metaprogramming part.

I fully agree with our assessment of parametric types. Generics are the worse thing I can thing of in Java.</description>
		<content:encoded><![CDATA[<p>James,</p>
<p>First, thanks for your insightful comments. I have to say I have started with Scala (and migrated to Groovy). I guess am a metaprogramming freak. A summary of my reasons can be found <a href="http://tiago.org/ps/2008/02/24/groovyscalarubypython-on-jvm/" rel="nofollow">here</a>. It would be fantastic to know that there are updates on the metaprogramming part.</p>
<p>I fully agree with our assessment of parametric types. Generics are the worse thing I can thing of in Java.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: James Iry</title>
		<link>http://tiago.org/cc/2009/01/05/groovy-type-crazyness/comment-page-1/#comment-457</link>
		<dc:creator>James Iry</dc:creator>
		<pubDate>Mon, 05 Jan 2009 22:54:21 +0000</pubDate>
		<guid isPermaLink="false">http://tiago.org/cc/?p=56#comment-457</guid>
		<description>In this comment I&#039;m using square brackets instead of angle brackets to prevent them from being eaten.

This isn&#039;t a problem related to different numeric types.  Groovy is essentially a dynamically typed language.  It has (almost) no static type system.

Even when you give type annotations like &quot;List[Double]&quot; you are specifying a runtime check, not a static check.  And that runtime check is unfortunately very simple: it has to be a List, but Groovy doesn&#039;t care what&#039;s in the list.   It&#039;s not really Groovy&#039;s fault.  In Java, parametric types like List[Double] are erased at runtime to just List, so Groovy has inherited that limitation in its runtime type checking.

groovy:000&gt; List[Double] lst = [1, &quot;hello&quot;, new RuntimeException(), &quot;I can be&quot; + &quot; whatever&quot;]
===&gt; [1, hello, java.lang.RuntimeException, I can be whatever]

For a statically typed alternative, check out Scala.  Generally it&#039;s a bit more succinct than Groovy except when you really need dynamic meta-programming.    

scala&gt; val lst = List(1.0, 2.0, 3.0)
lst: List[Double] = List(1.0, 2.0, 3.0)</description>
		<content:encoded><![CDATA[<p>In this comment I&#8217;m using square brackets instead of angle brackets to prevent them from being eaten.</p>
<p>This isn&#8217;t a problem related to different numeric types.  Groovy is essentially a dynamically typed language.  It has (almost) no static type system.</p>
<p>Even when you give type annotations like &#8220;List[Double]&#8221; you are specifying a runtime check, not a static check.  And that runtime check is unfortunately very simple: it has to be a List, but Groovy doesn&#8217;t care what&#8217;s in the list.   It&#8217;s not really Groovy&#8217;s fault.  In Java, parametric types like List[Double] are erased at runtime to just List, so Groovy has inherited that limitation in its runtime type checking.</p>
<p>groovy:000&gt; List[Double] lst = [1, "hello", new RuntimeException(), "I can be" + " whatever"]<br />
===&gt; [1, hello, java.lang.RuntimeException, I can be whatever]</p>
<p>For a statically typed alternative, check out Scala.  Generally it&#8217;s a bit more succinct than Groovy except when you really need dynamic meta-programming.    </p>
<p>scala&gt; val lst = List(1.0, 2.0, 3.0)<br />
lst: List[Double] = List(1.0, 2.0, 3.0)</p>
]]></content:encoded>
	</item>
</channel>
</rss>

