Skip to content

allow for custom protocol implementations to skip Has* methods #282

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

daaku
Copy link

@daaku daaku commented May 15, 2025

Please consider this change carefully - I'm not so familiar with the implications.

In experimenting with implementing a protocol using a custom struct, I found that for optional methods, the HasXXX method was required. This change makes it such that if the method XXX is implemented, but the corresponding HasXXX is not implemented, the method/selector is considered to be implemented.

This came out of me exploring the tableview example. Here's a significantly simpler version of the example (albeit without the dynamically changing data) using a custom NSTableViewDataSource implementation:

https://gist.github.com/daaku/be2cd99b492cfc75ba1efe23ca56acd0

@progrium
Copy link
Owner

Yeah, we inherited this design from a project that was absorbed and it always bugged me. I believe this is fine and I would really like this. Will leave this open for now to see if anybody else has input and also because I haven't had time to properly maintain/push forward lately. I usually work in bursts, but I'll be looking into this in the next burst.

I guess one thing people could do to help expedite is to try this branch and see that all the examples work, that their programs still work, etc and report back here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants