[swift-evolution] Empower String type with regular expression

Chris Lattner clattner at apple.com
Sun Jan 3 15:35:20 CST 2016


> On Jan 1, 2016, at 4:44 PM, John Joyce via swift-evolution <swift-evolution at swift.org> wrote:
>> It is also probably worth burning first-class language support for regexes.  This would allow specifying variable captures inline in the pattern, would allow flexible syntax for defining regexes, support powerful extensions to the base regex model (e.g. Perl 6 style), and would provide better compile-time checking and error recovery for mistakes.
>> 
>> -Chris
> I know this is an old thread already, but this sure would be one of the major breakout pieces of functionality.
> If Swift had native regular expressions, without all the noise you see in the Objective-C API that exposes ICU regular expressions, the adoption rate would be huge.
> If they were *truly* native, as in somebody sat down and built an NFA (or one of the fancier approaches that mixes with DFA) state machine, Swift's best-in-class Unicode support would and could result in amazing things.
> It'd boost the scripting use of Swift tremendously and seal the deal as a server side language.

Totally agreed.  switch on a string with a bunch of regexes being matched should turn into a parallel state machine, just like a lexer :-)

-Chris

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


More information about the swift-evolution mailing list