Re: [swift-evolution] [Pitch] Raw mode string literals

2017-11-25 Thread Thorsten Seitz via swift-evolution
> Am 24.11.2017 um 20:13 schrieb Xiaodi Wu via swift-evolution > : > >> On Thu, Nov 23, 2017 at 5:33 PM, Chris Lattner wrote: >>> On Nov 23, 2017, at 10:35 AM, Xiaodi Wu via swift-evolution >>> wrote: >>> This

Re: [swift-evolution] [Pitch] Raw mode string literals

2017-11-25 Thread Magnus Ahltorp via swift-evolution
> 24 Nov. 2017 08:33 Chris Lattner via swift-evolution > wrote: > > 2) I’d like to explore the idea of making // syntax be *patterns* instead of > simply literals. As a pattern, it should be possible to bind submatches > directly into variable declarations,

Re: [swift-evolution] [Pitch] Raw mode string literals

2017-11-24 Thread Xiaodi Wu via swift-evolution
On Sat, Nov 25, 2017 at 12:08 AM, Chris Lattner wrote: > > > On Nov 24, 2017, at 7:52 PM, Xiaodi Wu wrote: > > etc. Even if we don’t have a “default regex” for types, it would still be >> awesome to be able to write: >> >> >> if case /(let name:

Re: [swift-evolution] [Pitch] Raw mode string literals

2017-11-24 Thread Chris Lattner via swift-evolution
> On Nov 24, 2017, at 7:52 PM, Xiaodi Wu wrote: > > etc. Even if we don’t have a “default regex” for types, it would still be > awesome to be able to write: > > > if case /(let name: [a-zA-Z]+) (let count: Int: [0-9]+)/ = getSomeString() { >print(name, count) > } >

Re: [swift-evolution] [Pitch] Raw mode string literals

2017-11-24 Thread Xiaodi Wu via swift-evolution
On Fri, Nov 24, 2017 at 6:25 PM, Chris Lattner wrote: > > > On Nov 24, 2017, at 4:15 PM, Chris Lattner wrote: > > > than the same type having a collection of named matches using the usual > Perl syntax? > > if case /(?[a-zA-Z]+) (?[a-zA-Z]+)/ = >

Re: [swift-evolution] [Pitch] Raw mode string literals

2017-11-24 Thread Chris Lattner via swift-evolution
> On Nov 24, 2017, at 4:15 PM, Chris Lattner wrote: > >> >> than the same type having a collection of named matches using the usual Perl >> syntax? >> >> if case /(?[a-zA-Z]+) (?[a-zA-Z]+)/ = getSomeString() >> { >> print(Regex.captured["firstName"],

Re: [swift-evolution] [Pitch] Raw mode string literals

2017-11-24 Thread Chris Lattner via swift-evolution
: On Nov 24, 2017, at 11:12 AM, Xiaodi Wu wrote: > I think we've circled back to a topic that we've discussed here before. I do > agree that having more of this validation at compile time would improve the > experience. However, I can see a few drawbacks to the _compiler_

Re: [swift-evolution] [Pitch] Raw mode string literals

2017-11-24 Thread Xiaodi Wu via swift-evolution
On Thu, Nov 23, 2017 at 5:33 PM, Chris Lattner wrote: > On Nov 23, 2017, at 10:35 AM, Xiaodi Wu via swift-evolution < > swift-evolution@swift.org> wrote: > > This proposed addition addresses a known pain point, to be sure, but I > think it has many implications for the

Re: [swift-evolution] [Pitch] Raw mode string literals

2017-11-23 Thread Chris Lattner via swift-evolution
On Nov 23, 2017, at 10:35 AM, Xiaodi Wu via swift-evolution wrote: > This proposed addition addresses a known pain point, to be sure, but I think > it has many implications for the future direction of the language and I'd > like to explore them here. Thanks for

Re: [swift-evolution] [Pitch] Raw mode string literals

2017-11-23 Thread Kelvin Ma via swift-evolution
aren’t all literals evaluated at compile time? On Thu, Nov 23, 2017 at 6:07 PM, Tony Allevato wrote: > This could be solved by extending the existing string literal handling and > letting type inference do the rest. The real problem here is that > `UInt8(ascii: X)` is

Re: [swift-evolution] [Pitch] Raw mode string literals

2017-11-23 Thread Chris Lattner via swift-evolution
> On Nov 23, 2017, at 3:07 PM, Tony Allevato via swift-evolution > wrote: > > This could be solved by extending the existing string literal handling and > letting type inference do the rest. The real problem here is that > `UInt8(ascii: X)` is annoying to write

Re: [swift-evolution] [Pitch] Raw mode string literals

2017-11-23 Thread Tony Allevato via swift-evolution
This could be solved by extending the existing string literal handling and letting type inference do the rest. The real problem here is that `UInt8(ascii: X)` is annoying to write when you're dealing with a large amount of low-level data. If UInt8 conformed to ExpressibleByUnicodeScalarLiteral,

Re: [swift-evolution] [Pitch] Raw mode string literals

2017-11-23 Thread Kelvin Ma via swift-evolution
On Thu, Nov 23, 2017 at 3:47 PM, Tony Allevato via swift-evolution < swift-evolution@swift.org> wrote: > > > On Thu, Nov 23, 2017 at 12:21 PM Xiaodi Wu via swift-evolution < > swift-evolution@swift.org> wrote: > >> On Thu, Nov 23, 2017 at 2:14 PM, John Holdsworth via swift-evolution < >>

Re: [swift-evolution] [Pitch] Raw mode string literals

2017-11-23 Thread Chris Lattner via swift-evolution
> On Nov 23, 2017, at 11:10 AM, Brent Royal-Gordon > wrote: > > On Nov 23, 2017, at 11:15 AM, Chris Lattner via swift-evolution > > wrote: > >> Until we figure out that path forward for regex’s, I think

Re: [swift-evolution] [Pitch] Raw mode string literals

2017-11-23 Thread Xiaodi Wu via swift-evolution
On Thu, Nov 23, 2017 at 2:47 PM, Tony Allevato wrote: > > > On Thu, Nov 23, 2017 at 12:21 PM Xiaodi Wu via swift-evolution < > swift-evolution@swift.org> wrote: > >> On Thu, Nov 23, 2017 at 2:14 PM, John Holdsworth via swift-evolution < >> swift-evolution@swift.org>

Re: [swift-evolution] [Pitch] Raw mode string literals

2017-11-23 Thread Tony Allevato via swift-evolution
On Thu, Nov 23, 2017 at 12:21 PM Xiaodi Wu via swift-evolution < swift-evolution@swift.org> wrote: > On Thu, Nov 23, 2017 at 2:14 PM, John Holdsworth via swift-evolution < > swift-evolution@swift.org> wrote: > >> I’m beginning to wish I hadn’t tied this proposal so strongly to regular >>

Re: [swift-evolution] [Pitch] Raw mode string literals

2017-11-23 Thread Xiaodi Wu via swift-evolution
On Thu, Nov 23, 2017 at 2:14 PM, John Holdsworth via swift-evolution < swift-evolution@swift.org> wrote: > I’m beginning to wish I hadn’t tied this proposal so strongly to regular > expressions! > It is indeed the wrong motivation. Even as a ten year veteran of Perl > development > I’m not sure

Re: [swift-evolution] [Pitch] Raw mode string literals

2017-11-23 Thread John Holdsworth via swift-evolution
I’m beginning to wish I hadn’t tied this proposal so strongly to regular expressions! It is indeed the wrong motivation. Even as a ten year veteran of Perl development I’m not sure we want to bake it into the language quite so tightly (isn’t a part of Foundation?) What would /regex/ represent -

Re: [swift-evolution] [Pitch] Raw mode string literals

2017-11-23 Thread Xiaodi Wu via swift-evolution
On Thu, Nov 23, 2017 at 1:12 PM, Brent Royal-Gordon via swift-evolution < swift-evolution@swift.org> wrote: > On Nov 23, 2017, at 11:15 AM, Chris Lattner via swift-evolution < > swift-evolution@swift.org> wrote: > > Until we figure out that path forward for regex’s, I think they aren’t the >

Re: [swift-evolution] [Pitch] Raw mode string literals

2017-11-23 Thread Daniel Duan via swift-evolution
I eh, literally just ran into a situation where this feature would have been super useful: Someone sent me a JSON string with “\” in it. I needed to plug it into the UI logic to test something but I had to escape the “\”s again to make JSONSerialization happy. A raw string literal syntax,

Re: [swift-evolution] [Pitch] Raw mode string literals

2017-11-23 Thread Brent Royal-Gordon via swift-evolution
> On Nov 23, 2017, at 11:15 AM, Chris Lattner via swift-evolution > wrote: > > Until we figure out that path forward for regex’s, I think they aren’t the > right motivation for this proposal. 1. Even in our shining pattern matching future—a future which I, for one,

Re: [swift-evolution] [Pitch] Raw mode string literals

2017-11-23 Thread Xiaodi Wu via swift-evolution
This proposed addition addresses a known pain point, to be sure, but I think it has many implications for the future direction of the language and I'd like to explore them here. The tl;dr version is that I'm not sure this is the right direction in which to head to address the issue of regex

Re: [swift-evolution] [Pitch] Raw mode string literals

2017-11-23 Thread Chris Lattner via swift-evolution
> On Nov 23, 2017, at 9:43 AM, John Holdsworth via swift-evolution > wrote: > > Hello S/E, > > I’d like to put forward a perhaps rather banal change to the Swift lexer > primarily intended to make entering regular expression patterns easier. > >

[swift-evolution] [Pitch] Raw mode string literals

2017-11-23 Thread John Holdsworth via swift-evolution
Hello S/E, I’d like to put forward a perhaps rather banal change to the Swift lexer primarily intended to make entering regular expression patterns easier. https://github.com/DoubleSpeak/swift-evolution/blob/master/proposals/-raw-string-escaping.md