[swift-evolution] Strings in Swift 4

Joe Groff jgroff at apple.com
Mon Jan 23 16:27:46 CST 2017


> On Jan 23, 2017, at 2:06 PM, Ben Cohen via swift-evolution <swift-evolution at swift.org> wrote:
> 
> 
>> On Jan 23, 2017, at 7:49 AM, Joshua Alvarado <alvaradojoshua0 at gmail.com <mailto:alvaradojoshua0 at gmail.com>> wrote:
>> 
>> Taken from NSHipster <http://nshipster.com/nsregularexpression/>:
>> Happily, on one thing we can all agree. In NSRegularExpression, Cocoa has the most long-winded and byzantine regular expression interface you’re ever likely to come across.
>> 
>> There is no way to achieve the goal of being better at string processing than Perl without regular expressions being addressed. It just should not be ignored. 
> 
> 
> We’re certainly not ignoring the importance of regexes. But if there’s a key takeaway from your experiences with NSRegularExpression, it’s that a good regex implementation matters, a lot. That’s why we don’t want to rush one in alongside the rest of the overhaul of String. Instead, we should take our time to make it really great, and building on a solid foundation of a good String API that’s already in place should help ensure that.

I do think that there's some danger to focusing too narrowly on regular expressions as they appear in languages today. I think the industry has largely moved on to fully-structured formats that require proper parsing beyond what traditional regexes can handle. The decades of experience with Perl shows that making regexes too easy to use without an easy ramp up to more sophisticated string processing leads to people cutting corners trying to make regex-based designs kind-of work. The Perl 6 folks recognized this and developed their "regular expression" support into something that supported arbitrary grammars; I think we'd do well to start at that level by looking at what they've done.

-Joe

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170123/97907085/attachment.html>


More information about the swift-evolution mailing list