Serious class cluster/toll free bridging question (was: Newbie (to Cocoa) questions)
Serious class cluster/toll free bridging question (was: Newbie (to Cocoa) questions)
- Subject: Serious class cluster/toll free bridging question (was: Newbie (to Cocoa) questions)
- From: Michael Gersten <email@hidden>
- Date: Tue, 12 Mar 2002 22:17:46 -0800
What about _NEW_ versions of NSString, or NSMutableString, that are
created and returned by some other framework?
Lets say, for example, that there's a framework that includes a type
of string that is backed by a generator. Or, a generator and another
string (just for example, an encryption package that takes either an
NSString or a file, and returns something that conforms to the
NSString API, descends from NSString, and does lazy encryption of a
file-based encryption [instead of the typical stream-based
encryption])?
Or, if someone explicitly defines a set of <prefix>NonMutableString --
which is what should be the sibling of NSMutableString -- classes?
If a class CLUSTER is toll-free bridged, then one of these must be
true:
1. Only apple supplied members of the cluster is TFB, or
2. Frameworks can, and are expected to, provide CF*Ref equivalents of
any new NS-type class they add to a cluster
I've never seen any indication that 2 is possible. (I've never done
any carbon coding.) I've never seen any -[NSObject isTollFreeBridged]
method. (nor an -[NSObject convertToTFBEquivalent])
In fact, when I think of it, if number 2 is not done, then any new
cluster class must have a way to convert to an apple cluster class, or
it's of SERIOUSLY limited use -- anything in cocoa can be calling a
carbon or CF function assuming that it can use TFB on something new
That seriously hampers any attempt to extend a class cluster. In fact,
it kills it.
PLEASE, someone, tell me I'm wrong.
(Although, since I was unable to subclass NSTimer and have it work
correctly in my last project, and I think NSTimer is a class cluster,
this might be part of why.)
Douglas Davidson wrote:
>
>
On Thursday, March 7, 2002, at 12:33 PM, Lance Bland wrote:
>
>
>> One toll free bridged object is NSString.
>
>> [ [clip]
>
>
>
> NSString is a class cluster. By design, you don't know what it will
>
> return as a created instance. Is there a design specification (is it
>
> documented) that says everything it returns is toll-free with CFString,
>
> or just NSCString hidden class?
>
>
When we say it's toll-free bridged, we mean that any NSString can be
>
treated as a CFString, and vice versa.
>
>
Douglas Davidson
>
_______________________________________________
>
cocoa-dev mailing list | email@hidden
>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
>
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.