Re: [Pyobjc-dev] Protocol support
Brought to you by:
ronaldoussoren
From: Ronald O. <ron...@ma...> - 2005-03-02 06:58:50
|
On 1-mrt-05, at 22:14, Bob Ippolito wrote: > > On Mar 1, 2005, at 4:08 PM, Ronald Oussoren wrote: > >> >> On 18-feb-05, at 6:12, Bob Ippolito wrote: >>>>> >>>>> >>>>> It could use (at least) the following improvements: >>>>> - Protocols are not type checked. Anything in the base list that >>>>> is a PyObjCObject will get chunked into the protocol list. Will >>>>> probably crash if you do something really stupid (though there's >>>>> plenty of that in PyObjC anyway) >>>> Protocols are now typechecked. >>>> >>>> I've also added some unittests for this feature. >>>> >>>>> - Protocols can not be created from PyObjC >>>>> - selectors don't benefit from the Protocol information like they >>>>> do for informal protocols >>>>> - PyObjC doesn't verify that you implement the protocol like it >>>>> does for informal protocols >>>>> - objc.protocolNamed is probably pretty slow, should use a lookup >>>>> hash >>>> These still need to be implemented. >>> >>> I just added an objc.protocolsForClass, and re-implemented >>> protocolNamed in Python using a lookup hash but with the same search >>> algorithm. Could be faster if it cached classes it has seen, but I >>> guess maybe a category could change the behavior of that so this is >>> safer. >>> >>> The other three more important things are still unimplemented :) >> >> The other 3 are now also implemented (revision 1524). The code will >> see some restructuring in the future, but is fully functional. > > I noticed that in some of your tests you were casting Protocol to > NSObject, when it doesn't descent from NSObject at all.. Probably a > bad idea. That should be harmless, Object and Protocol implement the NSObject protocol. I never call NSObject methods on protocols, otherwise I'd have seen a warning message from Protocol when running objc.test.test_protocol. Ronald |