Search code examples
macrosreactive-cocoa

ReactiveCocoa: rac_keywordify macros. For what purpose rac_keywordify is actually need?


In ReactiveCocoa there are two macros which are using in conjunction.

#define weakify(...) \
    rac_keywordify \
    metamacro_foreach_cxt(rac_weakify_,, __weak, __VA_ARGS__)

#define strongify(...) \
    rac_keywordify \
    _Pragma("clang diagnostic push") \
    _Pragma("clang diagnostic ignored \"-Wshadow\"") \
    metamacro_foreach(rac_strongify_,, __VA_ARGS__) \
    _Pragma("clang diagnostic pop")

    #if DEBUG
    #define rac_keywordify autoreleasepool {}
    #else
    #define rac_keywordify try {} @catch (...) {}
    #endif

Could any one explain for what purpose actually need rac_keywordify? I read the description about rac_keywordify but still don't understand. And I will be much obliged if someone provide examples and description.


Solution

  • All rac_keywordify does is allow the use of the @ symbol as a required prefix in front of the weakify and strongify macros. The @ is not necessary, it's a style choice to make those macros look like keywords, like other language keywords, like @try or @synchronize.