[swift-evolution] Add conversion String -> Bool
davesweeris at mac.com
Sat Jun 4 12:02:48 CDT 2016
You may be right, but I'd imagine such a conversion function would be in pretty much any library for serializing/deserializing data.
I can't recall if this has been discussed before, but are we committed to One Standard Library to Rule Them All, or might we consider having a "standard" library and a "common extensions" library? (Personally, I'd prefer them to be split up so that 3rd-party library authors can import only what they need, but maybe that's just me.)
- Dave Sweeris
> On Jun 4, 2016, at 08:26, Taras Zakharko via swift-evolution <swift-evolution at swift.org> wrote:
> IMO, that is too idiosyncratic to be a standard language feature. You should extend Bool based on the specific needs of your application. Thats what the extensions are for.
>> On 04 Jun 2016, at 15:10, Arsen Gasparyan via swift-evolution <swift-evolution at swift.org> wrote:
>> It would be great if we had `init?(_ text: String)` for Bool class. Because sometime when you're processing JSON/XML it can help you a lot.
>> Bool("true") -> true
>> Bool("false") -> false
>> Bool("TrUE") -> true
>> Bool(" true ") -> nil
>> Bool("1") -> nil
>> Bool("Y") -> nil
>> Bool("whatever") -> nil
>> via https://bugs.swift.org/browse/SR-1282
>> swift-evolution mailing list
>> swift-evolution at swift.org
> swift-evolution mailing list
> swift-evolution at swift.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution