<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"><channel><title>mikeash.com pyblog/friday-qa-2012-06-01-a-tour-of-plweakcompatibility-part-ii.html comments</title><link>http://www.mikeash.com/?page=pyblog/friday-qa-2012-06-01-a-tour-of-plweakcompatibility-part-ii.html#comments</link><description>mikeash.com Recent Comments</description><lastBuildDate>Sun, 12 Apr 2026 02:24:42 GMT</lastBuildDate><generator>PyRSS2Gen-1.0.0</generator><docs>http://blogs.law.harvard.edu/tech/rss</docs><item><title>bob - 2013-01-17 11:29:53</title><link>http://www.mikeash.com/?page=pyblog/friday-qa-2012-06-01-a-tour-of-plweakcompatibility-part-ii.html#comments</link><description>Instead of pthread thread local storage, why not use [[NSThread currentThread] threadDictionary]?</description><guid isPermaLink="true">bd465abe7cac9f3ec1e07184f430ea95</guid><pubDate>Thu, 17 Jan 2013 11:29:53 GMT</pubDate></item><item><title>mikeash - 2012-07-19 14:04:30</title><link>http://www.mikeash.com/?page=pyblog/friday-qa-2012-06-01-a-tour-of-plweakcompatibility-part-ii.html#comments</link><description>You'd capture the class in the block and look up the IMP with it in the block, something like:
&lt;br /&gt;&lt;code&gt;
&lt;br /&gt;^(PLObjectPtr obj) {
&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// do some work here
&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// now call super
&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Class superclass = class_getSuperclass(c);
&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;void (*origIMP)(PLObjectPtr, SEL) = (__typeof__(origIMP))class_getMethodImplementation(superclass, releaseSELSwizzled);
&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;origIMP(self, _cmd);
&lt;br /&gt;};
&lt;br /&gt;&lt;/code&gt;
&lt;br /&gt;Since 'c' is captured by the block rather than looked up at runtime, it's always consistent, and 'superclass' is always correct.</description><guid isPermaLink="true">141499edd4a30902716b6f0d9e65a259</guid><pubDate>Thu, 19 Jul 2012 14:04:30 GMT</pubDate></item><item><title>Mike - 2012-07-16 13:18:49</title><link>http://www.mikeash.com/?page=pyblog/friday-qa-2012-06-01-a-tour-of-plweakcompatibility-part-ii.html#comments</link><description>Hey I am new to iOS development. Just curios as to how you would swizzle a method safely in both super and sub using imp_implementationWithBlock?</description><guid isPermaLink="true">a61c5b40186a8ac826fde3dc341ca451</guid><pubDate>Mon, 16 Jul 2012 13:18:49 GMT</pubDate></item></channel></rss>
