> On Jan 11, 2018, at 12:32 PM, Michael Ilseman via swift-dev > <swift-dev@swift.org> wrote: > > For a more general solution, I think a `var numericValue: Int? { get }` on > Character would make sense. Unicode defines (at least one) semantics for this > and ICU provides this functionality already. >
Minor style point – this should be a failable init on Int rather than a computed property on Character i.e. Int.init?(_: Character), matching Int.init?(_: String, radix: Int = 10), only it doesn’t need the radix arg cos it’s only a single character. If implemented inside the std lib, it can still access character’s internals, which is a reasonable thing to do for something so performance-sensitive.
_______________________________________________ swift-dev mailing list swift-dev@swift.org https://lists.swift.org/mailman/listinfo/swift-dev