rjmccall added a comment. In D75574#2202136 <https://reviews.llvm.org/D75574#2202136>, @theraven wrote:
> This feature looks generally useful. A few small suggestions: > > - This is really a way of transforming a formal protocol into an informal > protocol. Objective-C has had a convention of informal protocols since the > '80s, but they're implemented as categories on the root class with no > `@implementation`. I'd suggest that > `__attribute__((objc_informal_protocol))` or similar might be a better > spelling for this, explicitly bringing the informal notion into the language. > A lot of the informal protocols in Cocoa could be better expressed using > this and `@optional` methods than as categories on `NSObject`. It's still a formal protocol, it just doesn't have runtime representation. I think the name is appropriate. It's an interesting point that some of the informal protocols could be formalized without penalty using this, though. > - Given that this doesn't depend on any features in the runtime (from the > runtime's perspective, the protocol doesn't exist), I don't think it makes > sense to have an `ObjCRuntime` method to query whether this is supported by > the runtime. We should enable it everywhere if it's going in anywhere. Agreed. > - The changes required in CGObjcCGNU.cpp are fairly small and I agree that > @rjmccall's proposal for a callback-driven visitor would simplify the > changes in both runtimes. > - The semantics are slightly confusing with the deep approach though. > Normally, if you iterate over the protocols that a class conforms to, you > only see the ones that it directly conforms to. With this model, you'd see > indirect ones. We might want to set some metadata to allow programmers to > differentiate the two, or we might want to have a warning (off by default?) > if an informal protocol conforms to a formal one, or simply disallow it. I don't see why this information would be useful. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D75574/new/ https://reviews.llvm.org/D75574 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits