<?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/"
	xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
	>
<channel>
	<title>Comments on: Bug Or Feature, You Decide: Groovy MetaClass Programming</title>
	<atom:link href="http://enfranchisedmind.com/blog/posts/groovy-metaclass-bug/feed/" rel="self" type="application/rss+xml" />
	<link>http://enfranchisedmind.com/blog/posts/groovy-metaclass-bug/</link>
	<description>programming, politics, &#38; other religious issues</description>
	<lastBuildDate>Mon, 15 Mar 2010 00:31:40 +0000</lastBuildDate>
	
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: The Blog&#8217;s Most Popular Posts &#124; Enfranchised Mind</title>
		<link>http://enfranchisedmind.com/blog/posts/groovy-metaclass-bug/#comment-34395</link>
		<dc:creator>The Blog&#8217;s Most Popular Posts &#124; Enfranchised Mind</dc:creator>
		<pubDate>Sun, 12 Apr 2009 19:23:32 +0000</pubDate>
		<guid isPermaLink="false">http://enfranchisedmind.com/blog/?p=666#comment-34395</guid>
		<description>[...] Bug Or Feature, You Decide: Groovy MetaClass Programming [...]</description>
		<content:encoded><![CDATA[<p>[...] Bug Or Feature, You Decide: Groovy MetaClass Programming [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Upped The Recent Post/Popular Post Widget Count &#124; Enfranchised Mind</title>
		<link>http://enfranchisedmind.com/blog/posts/groovy-metaclass-bug/#comment-33658</link>
		<dc:creator>Upped The Recent Post/Popular Post Widget Count &#124; Enfranchised Mind</dc:creator>
		<pubDate>Tue, 12 Aug 2008 19:30:08 +0000</pubDate>
		<guid isPermaLink="false">http://enfranchisedmind.com/blog/?p=666#comment-33658</guid>
		<description>[...] Bug Or Feature, You Decide: Groovy MetaClass Programming  [...]</description>
		<content:encoded><![CDATA[<p>[...] Bug Or Feature, You Decide: Groovy MetaClass Programming  [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert Fischer</title>
		<link>http://enfranchisedmind.com/blog/posts/groovy-metaclass-bug/#comment-33457</link>
		<dc:creator>Robert Fischer</dc:creator>
		<pubDate>Mon, 30 Jun 2008 01:50:54 +0000</pubDate>
		<guid isPermaLink="false">http://enfranchisedmind.com/blog/?p=666#comment-33457</guid>
		<description>@npiv

If you do the &quot;x.metaClass&quot; without doing the &quot;X.metaClass&quot; beforehand, you get a metaClass -- of type MetaClassImpl, which does not have the same functionality as an ExpandoMetaClass.  But if you do X.metaClass first (before x is instantiated) then you&#039;ll get an ExpandMetaClass when you do &quot;x.metaClass&quot;.

This is what I was asserting as a bug.

&lt;em&gt;Which is what you are manually doing when calling X.metaClass, for the class X.&lt;/em&gt;

Really?  By accessing the metaClass, I&#039;m manually attaching an ExpandoMetaClass?  I thought I was just checking the static metaClass field off of the X class.

This is bug #2 in this issue: accessors should not have side effects.

You can talk on the Jira bug, but you might have better luck hitting the Groovy dev mailing list and asking exactly what *is* the intended behavior for instance-level metaclasses.</description>
		<content:encoded><![CDATA[<p>@npiv</p>
<p>If you do the &#8220;x.metaClass&#8221; without doing the &#8220;X.metaClass&#8221; beforehand, you get a metaClass &#8212; of type MetaClassImpl, which does not have the same functionality as an ExpandoMetaClass.  But if you do X.metaClass first (before x is instantiated) then you&#8217;ll get an ExpandMetaClass when you do &#8220;x.metaClass&#8221;.</p>
<p>This is what I was asserting as a bug.</p>
<p><em>Which is what you are manually doing when calling X.metaClass, for the class X.</em></p>
<p>Really?  By accessing the metaClass, I&#8217;m manually attaching an ExpandoMetaClass?  I thought I was just checking the static metaClass field off of the X class.</p>
<p>This is bug #2 in this issue: accessors should not have side effects.</p>
<p>You can talk on the Jira bug, but you might have better luck hitting the Groovy dev mailing list and asking exactly what *is* the intended behavior for instance-level metaclasses.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: npiv</title>
		<link>http://enfranchisedmind.com/blog/posts/groovy-metaclass-bug/#comment-33456</link>
		<dc:creator>npiv</dc:creator>
		<pubDate>Sun, 29 Jun 2008 15:10:01 +0000</pubDate>
		<guid isPermaLink="false">http://enfranchisedmind.com/blog/?p=666#comment-33456</guid>
		<description>@Robert  

&quot;Odd that an error isn’t thrown in this case, then.&quot;

Yes odd indeed, I was expecting that piece of code to fail.

I guess for performance reasons an object either has a metaclass or not attached to it. The default being not. the ExpandoMetaClass.enableGlobally() will probably just make sure that ExpandoMetaClass is enabled on all classes by default.

Which is what you are manually doing when calling X.metaClass, for the class X.

that being said, the code you posted is in contradiction with the API, so I might let myself be heard on that long JIRA ticket soon :P

something is not quite right, I might change my vote to bug soon</description>
		<content:encoded><![CDATA[<p>@Robert  </p>
<p>&#8220;Odd that an error isn’t thrown in this case, then.&#8221;</p>
<p>Yes odd indeed, I was expecting that piece of code to fail.</p>
<p>I guess for performance reasons an object either has a metaclass or not attached to it. The default being not. the ExpandoMetaClass.enableGlobally() will probably just make sure that ExpandoMetaClass is enabled on all classes by default.</p>
<p>Which is what you are manually doing when calling X.metaClass, for the class X.</p>
<p>that being said, the code you posted is in contradiction with the API, so I might let myself be heard on that long JIRA ticket soon :P</p>
<p>something is not quite right, I might change my vote to bug soon</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert Fischer</title>
		<link>http://enfranchisedmind.com/blog/posts/groovy-metaclass-bug/#comment-33455</link>
		<dc:creator>Robert Fischer</dc:creator>
		<pubDate>Sun, 29 Jun 2008 13:58:50 +0000</pubDate>
		<guid isPermaLink="false">http://enfranchisedmind.com/blog/?p=666#comment-33455</guid>
		<description>@npiv

There seems to be two general minds on this conversation (hence the &quot;Bug or Feature&quot; question).

One stance is that the entire concept of an &quot;isntance metaClass&quot; is nonsensical -- that behavior is defined at the class level, so mangling the behavior of an instance mandates mangling the behavior at the instance level.

This is not Groovy&#039;s approach.

Groovy allows mangling of instance metaClasses -- indeed, you can assign a whole new metaClass to a particular instance, which will &lt;em&gt;completely&lt;/em&gt; rewrite its type.  And it also allows mangling existing metaClasses at an instance-by-instance level (see my previous example, and the JIRA ticket I opened).  To me, this is the way Groovy should work, since the type system is already de facto out the window.  Duck typing and API mangling makes the class&#039;s type a suggestion -- at best -- as to a type&#039;s behavior.  The pseudo-object functionality offered by hashes even further blurs the lines around types.  So, given that types aren&#039;t terribly relevant in Groovy, I&#039;d say that we should go ahead and let mutability happen wherever: we&#039;ve already got enough rope to hang ourselves, why not actually get enough to do something useful?  And this behavior is inline with the cool kid on the block (Ruby).

Now, whether this is the best approach or not is a conversation for a different post.</description>
		<content:encoded><![CDATA[<p>@npiv</p>
<p>There seems to be two general minds on this conversation (hence the &#8220;Bug or Feature&#8221; question).</p>
<p>One stance is that the entire concept of an &#8220;isntance metaClass&#8221; is nonsensical &#8212; that behavior is defined at the class level, so mangling the behavior of an instance mandates mangling the behavior at the instance level.</p>
<p>This is not Groovy&#8217;s approach.</p>
<p>Groovy allows mangling of instance metaClasses &#8212; indeed, you can assign a whole new metaClass to a particular instance, which will <em>completely</em> rewrite its type.  And it also allows mangling existing metaClasses at an instance-by-instance level (see my previous example, and the JIRA ticket I opened).  To me, this is the way Groovy should work, since the type system is already de facto out the window.  Duck typing and API mangling makes the class&#8217;s type a suggestion &#8212; at best &#8212; as to a type&#8217;s behavior.  The pseudo-object functionality offered by hashes even further blurs the lines around types.  So, given that types aren&#8217;t terribly relevant in Groovy, I&#8217;d say that we should go ahead and let mutability happen wherever: we&#8217;ve already got enough rope to hang ourselves, why not actually get enough to do something useful?  And this behavior is inline with the cool kid on the block (Ruby).</p>
<p>Now, whether this is the best approach or not is a conversation for a different post.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
