Re: [swift-evolution] [Pitch] Making some RawRepresentable things bridge to ObjC as their raw value

2016-12-05 Thread Zach Waldowski via swift-evolution
I hate to be a thread necromancer, but I ran into the limits of the current behavior several times today alone. I was perhaps overexcited by the additional ObjectiveCBridgeable compliance of numeric types, and took off several `.rawValue`s in a way that were hard to track down. A few other exam

Re: [swift-evolution] [Idea] Extending syntax for `extension`

2016-12-05 Thread Xiaodi Wu via swift-evolution
One thing to consider: Access modifier rules for extensions as they were revised in the Swift 3 evolution process only work if extensions are guaranteed not to be nested, because they assume private in the outer scope is equal to fileprivate in the inner scope. (These rules differ from those for

Re: [swift-evolution] What about renaming Optional.map to Optional.mapMe ?

2016-12-05 Thread Xiaodi Wu via swift-evolution
Here's a good explanation of map and some other functional idioms in Swift: http://www.mokacoding.com/blog/functor-applicative-monads-in-pictures/ I hope it adequately explains to you why Optional, like Array, has a method called map. Unwrapping and rewrapping is inherent to the meaning of the ter

Re: [swift-evolution] What about renaming Optional.map to Optional.mapMe ?

2016-12-05 Thread Jay Zhao via swift-evolution
We can make the code condense when the optional is used as a parameter: /// Long version if let doubleValue = json["taken_at"].double { self.createTime = Date(timeIntervalSince1970:doubleValue) } /// Shourt version self.createTime = json

Re: [swift-evolution] [Idea] Extending syntax for `extension`

2016-12-05 Thread Braeden Profile via swift-evolution
No special restriction here. Like I said, it’s just another way of writing a file-level extension within that namespace. All the functions can then be defined as private, public, internal, etc. as necessary. The point would be to define functionality for something within the right block. If

Re: [swift-evolution] What about renaming Optional.map to Optional.mapMe ?

2016-12-05 Thread David Sweeris via swift-evolution
> On Dec 5, 2016, at 9:17 PM, David Sweeris via swift-evolution > wrote: > > >> On Dec 5, 2016, at 8:54 PM, Jay Zhao > > wrote: >> >> What about mapUnwrapped ? > > If the name is anything other than “map”, you already have to think of the > “special” word. At

Re: [swift-evolution] What about renaming Optional.map to Optional.mapMe ?

2016-12-05 Thread David Sweeris via swift-evolution
> On Dec 5, 2016, at 8:54 PM, Jay Zhao wrote: > > What about mapUnwrapped ? If the name is anything other than “map”, you already have to think of the “special” word. At that point, why not just unwrap it manually? _ = array2?.count vs _ = array2?.map {$0.count} I think this topic was discuss

Re: [swift-evolution] What about renaming Optional.map to Optional.mapMe ?

2016-12-05 Thread Alexis Beingessner via swift-evolution
This same issue applies to an Array of Arrays, wherein there is no renaming solution. That is, you've built a Collection of Collection, and have mixed up the inner and outer collections. I expect in most cases you'll run into a type error when you try to use the result. This is an unfortunate b

Re: [swift-evolution] What about renaming Optional.map to Optional.mapMe ?

2016-12-05 Thread Jay Zhao via swift-evolution
What about mapUnwrapped ? - Jay Zhao > On 6 Dec 2016, at 12:48, David Sweeris wrote: > > >> On Dec 5, 2016, at 7:46 PM, Jay Zhao via swift-evolution >> mailto:swift-evolution@swift.org>> wrote: >> >> Hi there, >> >> Code explains everything: >> >> >> >> /// Maybe a bad API naming in

Re: [swift-evolution] What about renaming Optional.map to Optional.mapMe ?

2016-12-05 Thread David Sweeris via swift-evolution
> On Dec 5, 2016, at 7:46 PM, Jay Zhao via swift-evolution > wrote: > > Hi there, > > Code explains everything: > > > > /// Maybe a bad API naming in Swift? See below: > > /// array1 can be array of any object that have a `count` method > let array1 = [[String]]() >

Re: [swift-evolution] What about renaming Optional.map to Optional.mapMe ?

2016-12-05 Thread Guillaume Lessard via swift-evolution
No. I would like to point out that, as used in functional programming, “map” matches the following dictionary definitions: Map (verb): • associate (a group of elements or qualities) with an equivalent group, according to a particular formula or model: the transformational rules map deep struct

Re: [swift-evolution] [Review] SE-0145: Package Manager Version Pinning (Revised)

2016-12-05 Thread Daniel Dunbar via swift-evolution
> On Dec 5, 2016, at 8:09 PM, Paul Cantrell wrote: > > >> On Dec 2, 2016, at 11:11 AM, Daniel Dunbar > > wrote: >> >> >>> On Nov 28, 2016, at 8:25 PM, Paul Cantrell via swift-evolution >>> mailto:swift-evolution@swift.org>> wrote: >>> >>> This version of the

Re: [swift-evolution] What about renaming Optional.map to Optional.mapMe ?

2016-12-05 Thread Jay Zhao via swift-evolution
Or maybe just: mapUnwrapped > On 6 Dec 2016, at 11:46, Jay Zhao wrote: > > Hi there, > > Code explains everything: > > > > /// Maybe a bad API naming in Swift? See below: > > /// array1 can be array of any object that have a `count` method > let array1 = [[String]](

Re: [swift-evolution] [Review] SE-0145: Package Manager Version Pinning (Revised)

2016-12-05 Thread Paul Cantrell via swift-evolution
> On Dec 2, 2016, at 11:11 AM, Daniel Dunbar wrote: > > >> On Nov 28, 2016, at 8:25 PM, Paul Cantrell via swift-evolution >> mailto:swift-evolution@swift.org>> wrote: >> >> This version of the proposal seems acceptable to me, though I have a nagging >> feel that it’s more complex than it nee

[swift-evolution] What about renaming Optional.map to Optional.mapMe ?

2016-12-05 Thread Jay Zhao via swift-evolution
Hi there, Code explains everything: /// Maybe a bad API naming in Swift? See below: /// array1 can be array of any object that have a `count` method let array1 = [[String]]() let array2 :[String]? = nil // I believe the confusion betwee

[swift-evolution] [swift-evolution-announce] [Accepted] SE-0145: Package Manager Version Pinning (Revised)

2016-12-05 Thread Anders Bertelrud via swift-evolution
Proposal Link: https://github.com/apple/swift-evolution/blob/master/proposals/0145-package-manager-version-pinning.md The review of "SE-0145: Package Manager Version Pinning" ran from Novemb

Re: [swift-evolution] [Discussion] Generic protocols

2016-12-05 Thread Daniel Leping via swift-evolution
Guys, I think we've got quit some positive feedback for this. Maybe it's time to go to proposal stage? I personally will back it 100%. If there is anything to add at this stage? On Mon, 5 Dec 2016 at 21:46 Adrian Zubarev via swift-evolution < swift-evolution@swift.org> wrote: > Syntactic sugar

Re: [swift-evolution] [Idea] Extending syntax for `extension`

2016-12-05 Thread Saagar Jha via swift-evolution
How exactly would this work? Would it restrict the extension to only the scope it’s defined in? Saagar Jha > On Dec 5, 2016, at 1:48 PM, Braeden Profile via swift-evolution > wrote: > > I really enjoy having the ability to write and nesting my code at the > appropriate indentation level in

[swift-evolution] [Idea] Extending syntax for `extension`

2016-12-05 Thread Braeden Profile via swift-evolution
I really enjoy having the ability to write and nesting my code at the appropriate indentation level in my file. Extensions are fabulous, but I wonder—solely for readability/style sake, could we allow you to properly namespace your extensions? Though I don’t know the implementation cost of thi

Re: [swift-evolution] [Discussion] Generic protocols

2016-12-05 Thread Adrian Zubarev via swift-evolution
Syntactic sugar could only solve the first issue because it would create a generic type that allows you to reuse your protocol with associated types in a way like ConstructibleFromValue would. The idea is simple, but there are a few disadvantages that makes it less worth to implement. If I sho

Re: [swift-evolution] Passing class protocols to functions accepting AnyObject

2016-12-05 Thread Joe Groff via swift-evolution
> On Dec 5, 2016, at 10:50 AM, Charles Srstka wrote: > >> On Dec 5, 2016, at 11:39 AM, Joe Groff > > wrote: >> >>> On Dec 4, 2016, at 6:46 PM, Charles Srstka via swift-evolution >>> mailto:swift-evolution@swift.org>> wrote: >>> >>> The following currently does not wor

Re: [swift-evolution] Passing class protocols to functions accepting AnyObject

2016-12-05 Thread Charles Srstka via swift-evolution
> On Dec 5, 2016, at 11:39 AM, Joe Groff wrote: > >> On Dec 4, 2016, at 6:46 PM, Charles Srstka via swift-evolution >> wrote: >> >> The following currently does not work: >> >> protocol P: class {} >> class C: P {} >> >> func foo(t: T) where T: AnyObject { >> print("foo") >> } >> >> le

Re: [swift-evolution] Passing class protocols to functions accepting AnyObject

2016-12-05 Thread Joe Groff via swift-evolution
> On Dec 4, 2016, at 6:46 PM, Charles Srstka via swift-evolution > wrote: > > The following currently does not work: > > protocol P: class {} > class C: P {} > > func foo(t: T) where T: AnyObject { > print("foo") > } > > let p: P = C() > > foo(t: p) // error: cannot invoke 'foo' with

Re: [swift-evolution] Passing class protocols to functions accepting AnyObject

2016-12-05 Thread Charles Srstka via swift-evolution
> On Dec 4, 2016, at 11:49 PM, Derrick Ho wrote: > > Does the following expression evaluate to true? > > p is AnyObject > > If it does then you may have found a bug. Not only does it evaluate to true, the compiler warns me that "'is' test is always true”. Charles ___

Re: [swift-evolution] [swift-evolution-announce] [Review] SE-0145: Package Manager Version Pinning (Revised)

2016-12-05 Thread Daniel Dunbar via swift-evolution
> On Dec 1, 2016, at 1:42 PM, Alexis via swift-evolution > wrote: > > Haven’t had a chance to catch up on the latest discussion, but I just saw > that the Yarn developers posted an excellent piece on lockfiles this week: > > https://yarnpkg.com/blog/2016/11/24/lockfiles-for-all >

[swift-evolution] Visualizing type hierarchy

2016-12-05 Thread Sebastian Grommes via swift-evolution
Hi guys, I am an informatics student and new to Swift / this mailing list - coming from Java. So please bare with me. One idea i had: Whenever i start working with a new Framework, it feels like a total clusterfuck, getting to know what works in which way and why. Especially understanding the fra

Re: [swift-evolution] Passing class protocols to functions accepting AnyObject

2016-12-05 Thread Anders Ha via swift-evolution
This is not a bug. Existentials of a protocol do not conform to the protocol. But I have no idea why the protocol conformance has not been implemented for at least protocols without `Self` or associated type requirements though. Regards, Anders > On 5 Dec 2016, at 3:46 AM, Charles Srstka via sw