Bob Ippolito avatar Bob Ippolito committed fcae9de

Remove unfinished stuff from NEWS, add protocols html to docs
bump version to 1.3b1

Comments (0)

Files changed (4)

Doc/protocols.html

+<?xml version="1.0" encoding="utf-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>
+PyObjC protocol support</title>
+</head>
+<body>
+<h2>PyObjC protocol support</h2>
+<h2><a name="introduction">Introduction</a></h2>
+<p>Apple makes use of both formal and informal protocols in the Cocoa framework.
+Formal protocols are those protocols that are implemented using Objective-C
+protocols:</p>
+<pre>
+@protocol NSFoo &lt;NSSomeProtocol&gt;
+-(int)doesIt;
+@end
+</pre>
+<p>Informal protocols on the other hand are purely documentation, the Objective-C 
+compiler doesn't know about them. For end users the main difference between
+formal and informal protocols is that you have to declare that you implement a
+formal protocol and that formal protocols do not have optional methods.</p>
+<h2><a name="informal-protocols-and-pyobjc">Informal protocols and PyObjC</a></h2>
+<p>PyObjC does have an explicit representation for informal protocols. This makes
+it possible to use the protocol description to provide better error messages and
+to automaticly deduce the method signatures for classes that implement an
+informal protocol.</p>
+<p>Informal protocols are represented using instances of 
+<code><span>objc.informal_protocol</span></code>. These instances are automaticly added to a registry,
+therefore it is not necessary to declare that you implement an informal 
+protocol.</p>
+<h2><a name="formal-protocols-and-pyobjc">Formal protocols and PyObjC</a></h2>
+<p>PyObjC also has an explicit representation for formal protocols.</p>
+<p>Formal protocols are represented as instances of <code><span>objc.formal_protocol</span></code>. 
+Unlike informal protocols you have to declare that you implement a formal 
+protocol to get all features of formal protocols. However, all formal protocols
+in Cocoa are also described using <code><span>objc.informal_protocol</span></code> objects.</p>
+<p>XXX: is this necessary? we could also use the same strategy as for informal
+protocols, and drop the informal_protocol wrappers for formal protocols.</p>
+<p>You can declare that you implement a formal protocol by using the protocol as
+a mix-in:</p>
+<pre>
+class MyLockingObject (NSObject, NSLocking):
+        def lock(self): pass
+        def unlock(self): pass
+</pre>
+<p>The class now formally implements the <code><span>NSLocking</span></code> protocol, you can check this
+using the Objective-C introspection methods:</p>
+<pre>
+&gt;&gt;&gt; MyLockingObject.pyobjc_classMethods.conformsToProtocol_(NSLocking)
+1
+</pre>
+<p>This is useful for API's that require (and check) the implementation of formal
+protocols.</p>
+<p>XXX: might also be useful for Distributed Objects, create an example</p>
+</body>
+</html>

Modules/objc/pyobjc.h

  * Central include file for PyObjC. 
  */
 
-#define OBJC_VERSION "1.3a1"
+#define OBJC_VERSION "1.3b1"
 
 // Loading in AppKit on Mac OS X 10.3 results in
 // a bit less than 1500 classes.
 interface will only get a unique proxy if the <code><span>__pyobjc_object__</span></code> method
 implements that feature.</p>
 </li>
-<li>(UNFINISHED) New RemotePyInterpreter example that demonstrates an
-out-of-process Python interpreter (primarily for IDE uses).</li>
 <li>New <code><span>objc.protocolsForClass</span></code> function that returns a list of protocols
 that the class directly claims to conform to.</li>
 <li>PyObjC classes can now declare that they implement formal protocols,
   interface will only get a unique proxy if the ``__pyobjc_object__`` method
   implements that feature.
 
-- (UNFINISHED) New RemotePyInterpreter example that demonstrates an
-  out-of-process Python interpreter (primarily for IDE uses).
-
 - New ``objc.protocolsForClass`` function that returns a list of protocols
   that the class directly claims to conform to.
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.