In NSAttributedString I found the following code (snippets)
======= NSAttributedString.m (snippets) ==============
static SEL getSel;
@implementation NSAttributedString
+ (void) initialize
{
if (self == [NSAttributedString class])
{
getSel = @selector(attributesAtIndex:effectiveRange:);
}
}
- (NSDictionary*) attributesAtIndex: (unsigned int)index
longestEffectiveRange: (NSRange*)aRange
inRange: (NSRange)rangeLimit
{
NSDictionary *attrDictionary;
IMP getImp;
getImp = [self methodForSelector: getSel];
attrDictionary = (*getImp)(self, getSel, index, aRange);
return attrDictionary;
}
@end
===========================================
Now I wonder.....
Why in Hell write that?
I mean what's wrong with:
attrDictionary = [self attributesAtIndex: index effectiveRange: aRange]
Why replace it by:
static SEL getSel;
getSel = @selector(attributesAtIndex:effectiveRange:);
getImp = [self methodForSelector: getSel];
attrDictionary = (*getImp)(self, getSel, index, aRange);
Yes, why????
why GNUstep code work so hard at being so obscure???
_______________________________________________
Discuss-gnustep mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/discuss-gnustep