Skip to content
This repository has been archived by the owner on Jun 2, 2018. It is now read-only.

Category method names should be prefixed #130

Closed
bdolman opened this issue Mar 22, 2013 · 7 comments
Closed

Category method names should be prefixed #130

bdolman opened this issue Mar 22, 2013 · 7 comments
Milestone

Comments

@bdolman
Copy link

bdolman commented Mar 22, 2013

What happens if Apple introduces -[NSDictionary map:] in iOS 7?

http://cocoamanifest.net/articles/2011/06/clash-of-the-categories.html

With such common method names, it's not unlikely that this could happen. Ideally you could name it bk_map instead of just map. Not as elegant, but 100x safer.

@atomkirk
Copy link

here, here! and then you could do something like magic record where they add something that lets people use the category methods without a prefix, so you could add this and make it somewhat "backwards compatible", as long as existing users add the flag to remove the prefix.

@zwaldowski
Copy link
Collaborator

It's being taken into consideration. Alex and I have discussed it from time to time. The whole idea of BlocksKit is that Apple would never introduce -[NSDictionary map:], because that's not how they write the language. The (optional) choice to use BlocksKit is an acknowledgement of the understanding of those method names, which is against Obj-C (but better for us). The runtime stuff we do would benefit greatly from prefixing

As far as MagicalRecord, while I like the kit itself, I can't stand behind the auto/sort-of/not-really prefixing. It's a mangling of C. We swizzled base methods on NSObject before, and it was a disaster. I'm afraid we won't be taking that approach, but stay tuned as far as prefixing other areas.

@seivan
Copy link

seivan commented Apr 16, 2013

I agree with @atomkirk @bdolman - I recently started prefixing categories as it makes it easier to find a particular category (couldn't resist) of categories. But yeah I'm not so much pro swizzling just to get rid of the prefixes. I don't use the MR shorthand, so I can't tell how properly it works, three additional characters isn't so bad :) (MR_) and makes it easier to find the selectors I'm looking for. MR_

@seivan
Copy link

seivan commented Apr 17, 2013

Any take on this?
It's getting annoying to see notification selectors on [NSNotificationCenter.defaultCenter ....] or [[self.collectionView perform ....] that's polluting the public interface.

EDIT: Just to clarify, I'm asking for your views on this if it would be feasible or if I should do a fork. I've been meaning to add some more stuff to BlocksKit as well.

@zwaldowski
Copy link
Collaborator

It's going to happen, just not during exam season. Sorry. But soon! Thanks for the support.

@zwaldowski
Copy link
Collaborator

I encourage you to fork if you have any extra features to have, but method prefixing of the whole shebang is on the roadmap for 2.0. We'll also intend to do a lot more safety checking for how A2DD's interference affects private uses (i.e., UIAlertView subclasses).

a2 added a commit that referenced this issue Jun 26, 2013
a2 added a commit that referenced this issue Jun 26, 2013
@zwaldowski
Copy link
Collaborator

Completed in next by #151.

a2 added a commit that referenced this issue Nov 7, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants