+1 on first-class regex support/pattern matching on regex patterns. There was a thread a while ago discussing compile-time code generation, and if I recall correctly one of the stated use cases was 'compiling'/'building' (don't know the real terminology) regex literals at compile-time. Is there a bigger overall vision for this sort of feature, or would it be better to just focus on better regex support?
Best, Austin On Sun, Jan 3, 2016 at 1:35 PM, Chris Lattner via swift-evolution < swift-evolution@swift.org> wrote: > On Jan 1, 2016, at 4:44 PM, John Joyce via swift-evolution < > swift-evolution@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 > > > _______________________________________________ > swift-evolution mailing list > swift-evolution@swift.org > https://lists.swift.org/mailman/listinfo/swift-evolution > >
_______________________________________________ swift-evolution mailing list swift-evolution@swift.org https://lists.swift.org/mailman/listinfo/swift-evolution