[swift-evolution] [Draft proposal] Faster/lower-level external String initialization

Guillaume Lessard glessard at tffenterprises.com
Fri Jan 15 14:03:10 CST 2016


I mostly like the proposal.
However, it seems to me that a single constructor could do the job of both:

init?(cString: UnsafePointer<CChar>, repairingUTF8: Bool = false)

(and similarly for the generic constructor.)

I agree that the static function could be called `decode(_:as:)`.


As for the implementation, I don’t like that the `UnsafePointer<CChar>` constructors choose to crash on a null pointer, when String.fromCString politely returned nil in that situation.

Cheers,
Guillaume Lessard



More information about the swift-evolution mailing list