Re: [swift-evolution] [pitch] Substring performance affordances

2017-07-02 Thread Dave Abrahams via swift-evolution
on Wed Jun 28 2017, Ben Cohen wrote: > Hi swift-evolution, > > Below is a short pitch for some performance improvements to be made to String > to accommodate > Substrings. > > As outlined in SE-0163, the more general question of implicit conversion from > Substring

Re: [swift-evolution] [Pitch] Contextual variables

2017-07-02 Thread rintaro ishizaki via swift-evolution
Ughh, my bad, let me withdraw this idea: func saveAndRestore(_ variable: inout T, _ tmpVal: T, body: () -> R) -> R { let savedVal = variable variable = tmpVal defer { variable = savedVal } return body() } var contextVal: Int = 0saveAndRestore(, 1) { print(contextVal) }

Re: [swift-evolution] [Pitch] Contextual variables

2017-07-02 Thread rintaro ishizaki via swift-evolution
2017-07-03 11:23 GMT+09:00 rintaro ishizaki via swift-evolution < swift-evolution@swift.org>: > > > 2017-06-28 21:33 GMT+09:00 Dimitri Racordon via swift-evolution < > swift-evolution@swift.org>: > >> Hello community! >> >> I’d like to pitch an idea for a user-friendly way for functions to pull

Re: [swift-evolution] [swift-evolution-announce] [Revised and review extended] SE-0180 - String Index Overhaul

2017-07-02 Thread Dave Abrahams via swift-evolution
Hi Karl, It was pointed out to me that I never answered this thoughtful post of yours... on Mon Jun 26 2017, Karl Wagner wrote: >> On 23. Jun 2017, at 02:59, Kevin Ballard via swift-evolution >> wrote: >> >>

Re: [swift-evolution] [Pitch] Contextual variables

2017-07-02 Thread rintaro ishizaki via swift-evolution
2017-06-28 21:33 GMT+09:00 Dimitri Racordon via swift-evolution < swift-evolution@swift.org>: > Hello community! > > I’d like to pitch an idea for a user-friendly way for functions to pull > values from an arbitrary environment. Let me introduce the concept with a > motivational example before I

Re: [swift-evolution] Would having "MyType.Protocol" to indicate a type's protocols mess anything up?

2017-07-02 Thread Christopher Kornher via swift-evolution
A full-fledged introspection system should provide this information, which I suppose could be useful for creating proxies through code generation or dynamic Objective-C like features, should they ever be added to the language. Would that be sufficient for your needs? It is not clear to me what

Re: [swift-evolution] Would having "MyType.Protocol" to indicate a type's protocols mess anything up?

2017-07-02 Thread Daryle Walker via swift-evolution
> On Jul 1, 2017, at 2:07 AM, Brent Royal-Gordon wrote: > >> On Jun 30, 2017, at 6:17 PM, Daryle Walker via swift-evolution >> > wrote: >> >> Given a type MyType, how can I get a type-alias to the type’s

Re: [swift-evolution] [Pitch] Contextual variables

2017-07-02 Thread Brent Royal-Gordon via swift-evolution
> On Jun 28, 2017, at 5:33 AM, Dimitri Racordon via swift-evolution > wrote: > > Using our contextual variables, one could rewrite our motivational example as > follows: > > class Interpreter: Visitor { > func visit(_ node: BinExpr) { > let lhs, rhs :

[swift-evolution] How many kinds of declarations can a named type hold?

2017-07-02 Thread Daryle Walker via swift-evolution
I think I got most of this, but it’s hard to completely figure out because the information is scattered across the grammar. So, I’m coming up with a statement to copy over a member from one type to another: publish MEMBER-FROM-OTHER-TYPE and I’m trying to encapsulate this into a grammar. This

Re: [swift-evolution] [Pitch] Introducing the "Unwrap or Die" operator to the standard library

2017-07-02 Thread Georgios Moschovitis via swift-evolution
> let last = array.last ?? fatalError(“array must not be empty”) I prefer, the above, explicit version. -g. ___ swift-evolution mailing list swift-evolution@swift.org https://lists.swift.org/mailman/listinfo/swift-evolution