Skip navigation.
 
mlSo-called toll free bridged classes
FROM : Martin-Gilles Lavoie
DATE : Thu Nov 21 08:48:00 2002

While I'm working out the details of a class-action suit against Scott
Anguish & Al for their wrist-breaking but otherwise excellent Cocoa
programming book (www.cocoaprogramming.net), I have a question
regarding what they refer to as "toll free bridged" classes.

In reference to NSData, NSStyring, NSDictionary, NSArray, NSDate,
NSRunLoopTimer, NSSet, NSCharacterSet and NSURL classes having their
exact CF* (eg CFString) correspondances, which are said to be castable
from one type to the other (page 186, first paragraph through third).

For those who don't have wrist pains yet, the book goes on to say that

   NSString*        myString = [[NSString alloc] initWithString: @"test"];

can then

   CFStringRef    myCFString = (CFStringRef) myString;


How much can I rely on NS* being actually cast-able to CF* objects?

Is this a documented design goal that can be expected for the futur, or
a fluke caused by the separation of what has become the Core Foundation
from the Cocoa private implementation?

______________________________________________________________________
Martin-Gilles Lavoie
http://www.oracle.com


Related mailsAuthorDate
mlSo-called toll free bridged classes Martin-Gilles Lavo… Nov 21, 08:48
mlRe: So-called toll free bridged classes Matt Watson Nov 21, 08:59
mlRe: So-called toll free bridged classes Eric Peyton Nov 21, 09:00