Skip to content

Added ARC Compatibility#1

Closed
bunchjesse wants to merge 1 commit into
jivadevoe:masterfrom
bunchjesse:ARC-Compatibility
Closed

Added ARC Compatibility#1
bunchjesse wants to merge 1 commit into
jivadevoe:masterfrom
bunchjesse:ARC-Compatibility

Conversation

@bunchjesse

Copy link
Copy Markdown

I added some macros to check for ARC usage and, if not enabled, call normal release on the blocks you're owning. The code should work on both ARC and non-ARC projects.

@jivadevoe

Copy link
Copy Markdown
Owner

At this time, I am not accepting patches to move this code to ARC. This is so that the code can maintain backwards compatibility for users who have not yet moved to ARC. I'll keep the pull request open, however, and when I do convert it to ARC, I'll close it.

Thanks for the pull request anyway though.

@bunchjesse

Copy link
Copy Markdown
Author

Thanks for your reply. If you look at my commit, I added macros to take care of the compatibility. My commit is 100% backwards-compatible---so no changes are required on the part of those who've not made the move to ARC.

@jivadevoe

Copy link
Copy Markdown
Owner

Yeah, I absolutely appreciate what you did there. However, the macros actually make me less likely to use this patch directly.

This partially falls over into a philosophical issue. One which I may or may not be in the minority on, but here goes:

#1. I feel that preprocessor macros are generally a "bad thing". They're a tool, and a very valuable tool when you need them, but they should be used only as a last resort in these kinds of situations. In this case, a much better tool is simply to disable ARC for these files when you add them to your project. This is simple to do, and doesn't clutter the code.

#2. Even if I wanted to include preprocessor macros for making this code compatible with ARC or not, preprocessor macros that define retain/release replacements are generally a "very bad thing", and should be avoided at all costs. You should never, ever do this.

#3. An appropriate use of macros, in this case, might be to use the __has_feature(objc_arc) macro to determine if ARC is NOT enabled in a file which requires it so that you can display a compiler error to alert the user that they should enable ARC for that file. Since release/retain/dealloc cause errors when compiled with ARC, no such macro is needed for files that have not been converted to ARC.

@jivadevoe jivadevoe closed this Jan 19, 2012
@bunchjesse

Copy link
Copy Markdown
Author

We do have a philosophical disagreement, but it's your project and I respect your wishes.

Thanks for your time!

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