<?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: Class Extensions Explained</title>
	<atom:link href="http://www.friday.com/bbum/2009/09/11/class-extensions-explained/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.friday.com/bbum/2009/09/11/class-extensions-explained/</link>
	<description>...so google can index my head.</description>
	<lastBuildDate>Wed, 08 Feb 2012 15:29:18 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Nimrod</title>
		<link>http://www.friday.com/bbum/2009/09/11/class-extensions-explained/comment-page-1/#comment-195649</link>
		<dc:creator>Nimrod</dc:creator>
		<pubDate>Fri, 15 Oct 2010 17:41:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.friday.com/bbum/?p=1537#comment-195649</guid>
		<description>Great explanation. Thanks! This was very useful.</description>
		<content:encoded><![CDATA[<p>Great explanation. Thanks! This was very useful.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dan</title>
		<link>http://www.friday.com/bbum/2009/09/11/class-extensions-explained/comment-page-1/#comment-193076</link>
		<dc:creator>Dan</dc:creator>
		<pubDate>Fri, 05 Feb 2010 19:50:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.friday.com/bbum/?p=1537#comment-193076</guid>
		<description>Darn.  And thanks, but darn. I guess it&#039;s plan B then: put all of my source code into one file. (j/k)</description>
		<content:encoded><![CDATA[<p>Darn.  And thanks, but darn. I guess it&#8217;s plan B then: put all of my source code into one file. (j/k)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bbum</title>
		<link>http://www.friday.com/bbum/2009/09/11/class-extensions-explained/comment-page-1/#comment-193075</link>
		<dc:creator>bbum</dc:creator>
		<pubDate>Fri, 05 Feb 2010 15:59:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.friday.com/bbum/?p=1537#comment-193075</guid>
		<description>Dan -- it is a good idea, but won&#039;t work in practice.  A class extension doesn&#039;t declare the superclass and, thus, the compiler wouldn&#039;t know about any inherited methods when it only saw the extension.   It would also be incompatible with the 32 bit Mac OS X runtime in that the compiler has to see the instance variables of the super classes to be able to correctly layout ivars in the current class.

However, if you are willing to be &quot;limited&quot; to 64 bit and iPhone OS only (the only downside being lack of compatibility with the simulator), you can achieve what you want today using a combination of synthesized properties (that also synthesize ivars) and class extensions at the top of the .m to hold private properties and method declarations.</description>
		<content:encoded><![CDATA[<p>Dan &#8212; it is a good idea, but won&#8217;t work in practice.  A class extension doesn&#8217;t declare the superclass and, thus, the compiler wouldn&#8217;t know about any inherited methods when it only saw the extension.   It would also be incompatible with the 32 bit Mac OS X runtime in that the compiler has to see the instance variables of the super classes to be able to correctly layout ivars in the current class.</p>
<p>However, if you are willing to be &#8220;limited&#8221; to 64 bit and iPhone OS only (the only downside being lack of compatibility with the simulator), you can achieve what you want today using a combination of synthesized properties (that also synthesize ivars) and class extensions at the top of the .m to hold private properties and method declarations.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dan</title>
		<link>http://www.friday.com/bbum/2009/09/11/class-extensions-explained/comment-page-1/#comment-193074</link>
		<dc:creator>Dan</dc:creator>
		<pubDate>Fri, 05 Feb 2010 15:03:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.friday.com/bbum/?p=1537#comment-193074</guid>
		<description>One of the very few things I dislike about Obj-C over other languages is the lingering need for header files (unlike Java, Python, etc.). But I&#039;ve recently thought of an approach that, while not making them unnecessary, at least would reduce the back-and-forth between editing the two files, somewhat. However, I&#039;m wondering if it will lead to unexpected problems.
The approach would be to put the only the class extension @interface in the header, declaring the methods and properties I want other classes to be aware of (thus &quot;public&quot;), while the interface containing the ivars and private methods would be in the implementation (.m) file. Is this plan &quot;so crazy, it just might work!&quot;, or a &quot;bag of hurt (tm)&quot;?  Secondly, if it would work, would Clang&#039;s static analyzer have trouble understanding it? Would code sense?
Lastly, I&#039;d like to thank you for your profuse and generous contributions to the Cocoa development community&#039;s knowledge base! It really is appreciated by so many of us.</description>
		<content:encoded><![CDATA[<p>One of the very few things I dislike about Obj-C over other languages is the lingering need for header files (unlike Java, Python, etc.). But I&#8217;ve recently thought of an approach that, while not making them unnecessary, at least would reduce the back-and-forth between editing the two files, somewhat. However, I&#8217;m wondering if it will lead to unexpected problems.<br />
The approach would be to put the only the class extension @interface in the header, declaring the methods and properties I want other classes to be aware of (thus &#8220;public&#8221;), while the interface containing the ivars and private methods would be in the implementation (.m) file. Is this plan &#8220;so crazy, it just might work!&#8221;, or a &#8220;bag of hurt &#8482;&#8221;?  Secondly, if it would work, would Clang&#8217;s static analyzer have trouble understanding it? Would code sense?<br />
Lastly, I&#8217;d like to thank you for your profuse and generous contributions to the Cocoa development community&#8217;s knowledge base! It really is appreciated by so many of us.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Mitchell</title>
		<link>http://www.friday.com/bbum/2009/09/11/class-extensions-explained/comment-page-1/#comment-192501</link>
		<dc:creator>Jonathan Mitchell</dc:creator>
		<pubDate>Wed, 09 Dec 2009 15:48:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.friday.com/bbum/?p=1537#comment-192501</guid>
		<description>Class extensions come galloping to the rescue when you turn on GCC_WARN_UNDECLARED_SELECTOR.
All those callback message selectors that you forgot to declare anywhere can be decanted into the extension without polluting the public interface.</description>
		<content:encoded><![CDATA[<p>Class extensions come galloping to the rescue when you turn on GCC_WARN_UNDECLARED_SELECTOR.<br />
All those callback message selectors that you forgot to declare anywhere can be decanted into the extension without polluting the public interface.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael James</title>
		<link>http://www.friday.com/bbum/2009/09/11/class-extensions-explained/comment-page-1/#comment-192142</link>
		<dc:creator>Michael James</dc:creator>
		<pubDate>Thu, 05 Nov 2009 22:40:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.friday.com/bbum/?p=1537#comment-192142</guid>
		<description>Found this out through experimentation:

To access the readwrite property from subclasses, re-declare the property as readwrite in your subclass&#039;s class extension and use &quot;@dynamic propertyName&quot; in the @implementation section.  Seems to work.

Sorry for the typos.</description>
		<content:encoded><![CDATA[<p>Found this out through experimentation:</p>
<p>To access the readwrite property from subclasses, re-declare the property as readwrite in your subclass&#8217;s class extension and use &#8220;@dynamic propertyName&#8221; in the @implementation section.  Seems to work.</p>
<p>Sorry for the typos.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kyle Sluder</title>
		<link>http://www.friday.com/bbum/2009/09/11/class-extensions-explained/comment-page-1/#comment-191569</link>
		<dc:creator>Kyle Sluder</dc:creator>
		<pubDate>Sun, 13 Sep 2009 03:25:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.friday.com/bbum/?p=1537#comment-191569</guid>
		<description>Ahruman, are you sure about accessing synthesized ivars being a bug? I thought the bug was that one couldn&#039;t get at the synthesized ivar and therefore had to implement -dealloc by calling setters. Now we can use self-&gt;ivar notation.</description>
		<content:encoded><![CDATA[<p>Ahruman, are you sure about accessing synthesized ivars being a bug? I thought the bug was that one couldn&#8217;t get at the synthesized ivar and therefore had to implement -dealloc by calling setters. Now we can use self-&gt;ivar notation.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bbum&#39;s weblog-o-mat » Blog Archive » Class Extensions Explained interface</title>
		<link>http://www.friday.com/bbum/2009/09/11/class-extensions-explained/comment-page-1/#comment-191561</link>
		<dc:creator>bbum&#39;s weblog-o-mat » Blog Archive » Class Extensions Explained interface</dc:creator>
		<pubDate>Sat, 12 Sep 2009 12:17:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.friday.com/bbum/?p=1537#comment-191561</guid>
		<description>[...] Read the original post: bbum&#039;s weblog-o-mat » Blog Archive » Class Extensions Explained [...]</description>
		<content:encoded><![CDATA[<p>[...] Read the original post: bbum&#39;s weblog-o-mat » Blog Archive » Class Extensions Explained [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Drew McCormack</title>
		<link>http://www.friday.com/bbum/2009/09/11/class-extensions-explained/comment-page-1/#comment-191558</link>
		<dc:creator>Drew McCormack</dc:creator>
		<pubDate>Sat, 12 Sep 2009 09:07:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.friday.com/bbum/?p=1537#comment-191558</guid>
		<description>One thing I have wanted to do at various times is expose a immutable property, but back it with a mutable ivar. So I wanted this in the public interface

&lt;code&gt;@property (readonly) NSArray *array;&lt;/code&gt;

and in the class extension I wanted to use this

&lt;code&gt;@property (readwrite) NSMutableArray *array;&lt;/code&gt;

This doesn&#039;t seem to be allowed by the compiler. Of course, you can get around it by simply renaming the ivar to mutableArray or something, but it seemed like something that should be possible (ie upcasting of a class in a property.</description>
		<content:encoded><![CDATA[<p>One thing I have wanted to do at various times is expose a immutable property, but back it with a mutable ivar. So I wanted this in the public interface</p>
<p><code>@property (readonly) NSArray *array;</code></p>
<p>and in the class extension I wanted to use this</p>
<p><code>@property (readwrite) NSMutableArray *array;</code></p>
<p>This doesn&#8217;t seem to be allowed by the compiler. Of course, you can get around it by simply renaming the ivar to mutableArray or something, but it seemed like something that should be possible (ie upcasting of a class in a property.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tweets that mention bbum’s weblog-o-mat » Blog Archive » Class Extensions Explained -- Topsy.com</title>
		<link>http://www.friday.com/bbum/2009/09/11/class-extensions-explained/comment-page-1/#comment-191553</link>
		<dc:creator>Tweets that mention bbum’s weblog-o-mat » Blog Archive » Class Extensions Explained -- Topsy.com</dc:creator>
		<pubDate>Fri, 11 Sep 2009 22:03:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.friday.com/bbum/?p=1537#comment-191553</guid>
		<description>[...] This post was mentioned on Twitter by Mike Clark, JivaDeVoe and Matthew Tonkin. Mike Clark said: @bbum&#039;s &quot;Class Extensions Explained&quot; is another must-read for ObjC programmers: http://bit.ly/778Gg [...]</description>
		<content:encoded><![CDATA[<p>[...] This post was mentioned on Twitter by Mike Clark, JivaDeVoe and Matthew Tonkin. Mike Clark said: @bbum&#39;s &quot;Class Extensions Explained&quot; is another must-read for ObjC programmers: <a href="http://bit.ly/778Gg" >http://bit.ly/778Gg</a> [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>

