[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
NSAttributeString source code....
From: |
Lloyd Dupont |
Subject: |
NSAttributeString source code.... |
Date: |
Fri, 2 Jun 2006 19:24:03 +1000 |
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???
- NSAttributeString source code....,
Lloyd Dupont <=