On 15/12/2015 16:05, H. Hirzel wrote:
On 12/15/15, Ben Coman <btc@openinworld.com> wrote:
On Thu, Dec 10, 2015 at 12:37 AM, Todd Blanchard <tblanchard@mac.com> wrote:
They are practically the same thing.
ICU was developed by Taligent which was a joint venture between Apple and IBM. Makes sense that NSString and ICU's UnicodeString are pretty close in implementation. ICU was also ported to Java for Sun by IBM. The point is - this is a very elaborate chunk of code with far reach. If ICU is wrong on some point - it is universally wrong and thus likely to be taken as "right" as it is at least consistent. I think re-implementing it is folly TBH. Just use it.
I suspect the history is wrong as NSString was first written at NeXT when they were not Apple and was not unicode aware at first, but the end result does seem to be NSString now uses ICU
Apple seem to have moved on from NSString to support Unicode in a different way in Switft...
Could you please give some more details?
I have read https://www.objc.io/issues/9-strings/unicode/#nsstring-and-unicode so far.
It says that an NSString object actually represents an array of UTF-16-encoded code units.
This in contrast to Squeak / Pharo where a String is an ArrayedCollection of 21 bit Unicode code points (transparently optimizing to a ByteArray if the string only contains values of the first code page).
The Swift code (well for the next version) is open source see https://github.com/apple/swift-corelibs-foundation for the Foundation lib which includes Strings. Foundation is being rewritten in Swift rather than Objective C so should be Swift->C but I wonder if it is really clean yet, i.e. do they need all the current code. A quick scan gives the low level as Stringing (same as current OSX_. The encodings and conversions seem to use ICU to do the work (which is UTF-16 based) Also in NSString.swift is the line public typealias unichar = UInt16
On Dec 8, 2015, at 15:52, EuanM <euanmee@gmail.com> wrote:
Equally old are the NextStep Object C functions which are now embodied within MacOS X.
-- Mark