4 ms·
> ..Obj-C... assumed Unicode...use 2 byte encodings That's actually not entirely accurate. NSString in Foundation was (and is, sort of) a class cluster that i
by mpweiher 8y ago
> ..Obj-C... assumed Unicode...use 2 byte encodings
That's actually not entirely accurate. NSString in Foundation was (and is, sort of) a class cluster that is quite flexible and agnostic about the actual encoding of the representations. I remember this quite clearly, because I fleshed out some of the missing NSString pieces in libFoundation, which was a fairly clean/simple implementation of the OPENSTEP Foundation spec.
What locked in the representation was CoreFoundation, Apple's C re-implementation of Foundation for the Carbon crowd, who apparently wouldn't countenance even linking against Objective-C, even if hidden behind a C facade.
So instead of taking the tried-and-true, fast and flexible Foundation and adding some wrappers, the existing Foundation had to be abandoned and rebuilt on top of a newly-written much inferior object-oriented C library.
With that, we got much worse performance[1], much reduced flexibility in terms of representation and locking away of flexibility. Just as an example, the binary plist format is quite capable, but almost all of that capability is lost because it's hidden behind a monolithic C API.
Now there are some issues in the API, for example just a single "length" attribute that clashes with NSData's length and makes it...challenging...to present both Byte and String faces at the same time, making for a lot of otherwise unnecessary copying and conversion.
[1] https://groups.google.com/group/comp.sys.next.advocacy/browse_thread/thread/b8e4270b5c44d004/701f32da45fc84fe?lnk=st&q=Quartz+buck+group%3Acomp.sys.next.*# https://groups.google.com/group/comp.sys.next.advocacy/brows...