Re: [swift-users] Protocol associated type constraints in classes and structs ?

2017-02-10 Thread Matthew Johnson via swift-users
Hi Trevör, What you’re asking for has been discussed extensively and a very thorough proposal was drafted by Austin Zheng: https://github.com/austinzheng/swift-evolution/blob/az-existentials/proposals/-enhanced-existentials.md This is not something that is likely to make it into Swift 4

[swift-users] Protocol associated type constraints in classes and structs ?

2017-02-10 Thread Trevör ANNE DENISE via swift-users
Hello everyone ! I am currently writing a project where I would like to do something similar to this: protocol ProtocolA { associatedtype U var someVariable : U { get set } func someFunction(_ x:U) -> U } class SomeClass { var someProperty : ProtocolA where ProtocolA.U == T }

Re: [swift-users] Protocol associated type constraints in classes and structs ?

2017-02-10 Thread Trevör Anne Denise via swift-users
> Le 10 févr. 2017 à 18:04, Trevör Anne Denise a > écrit : > > Hi Matthew, > > Thanks for this quick reply, happy to see that this is something the > community is working on, this will make protocols even more useful! > > Since this isn't implemented yet, I am

Re: [swift-users] So how do you implement a NSTextStorage subclass in Swift?

2017-02-10 Thread Jacob Bandes-Storch via swift-users
This seems like a bug (missing feature?) in how the API is imported for Swift. You might consider filing a Radar. On Thu, Feb 9, 2017 at 3:12 PM Michel Fortin via swift-users < swift-users@swift.org> wrote: > The `string` property of `NSTextStorage` is of type `String`, but the > contract it

Re: [swift-users] [swift-evolution] Plan to move swift-evolution and swift-users mailing lists to Discourse

2017-02-10 Thread Robert Widmann via swift-users
~Robert Widmann 2017/02/10 3:35、Tino Heth via swift-evolution のメッセージ: > >> Easy explained - The problem rises indeed not from the added features but >> from the fp group that imposes it’s usage in the Standard libraries and “the >> swifty way”. I like many

Re: [swift-users] So how do you implement a NSTextStorage subclass in Swift?

2017-02-10 Thread Jacob Bandes-Storch via swift-users
Got some clarity on this from Apple folks on Twitter: https://twitter.com/jtbandes/status/830159670559993856 On Fri, Feb 10, 2017 at 12:54 PM, Michel Fortin wrote: > I did file one (30314719). I might not have explained the problem clearly > enough, I suppose, because

Re: [swift-users] for with optional collection?

2017-02-10 Thread Jacob Bandes-Storch via swift-users
To me it would seem more logical as "for x in array? { }" — to parallel "for case let x? in array { }" On Fri, Feb 10, 2017 at 1:03 PM, Rick Mann via swift-users < swift-users@swift.org> wrote: > I love the idea of for in? (Or even for? In). You should pitch that to > evolution. > > Sent from

Re: [swift-users] for with optional collection?

2017-02-10 Thread Rick Mann via swift-users
How would you write for x in array as? With parentheses? I like "in?" because it mimics "as?". Sent from my iPhone > On Feb 10, 2017, at 13:57, Jacob Bandes-Storch wrote: > > To me it would seem more logical as "for x in array? { }" — to parallel "for > case let x? in

Re: [swift-users] for with optional collection?

2017-02-10 Thread Rick Mann via swift-users
I love the idea of for in? (Or even for? In). You should pitch that to evolution. Sent from my iPhone > On Feb 10, 2017, at 07:04, Tino Heth <2...@gmx.de> wrote: > > >> Is there any concise way to write the following? >> >> if let collection = someOptionalCollection >> { >>for item in

Re: [swift-users] Swift kernel for Jupyter Notebook/IPython

2017-02-10 Thread David Young via swift-users
On Thu, Feb 09, 2017 at 12:31:00AM +, Jin Wang wrote: > Hey David, > > I'm currently using the existing REPL to power the code execution. > Eventually, when Swift becomes more stable and Linux gets more support, we > might be able to do visualisations using UIKit or its alternatives. Right >

Re: [swift-users] Swift kernel for Jupyter Notebook/IPython

2017-02-10 Thread David Young via swift-users
On Thu, Feb 09, 2017 at 12:31:00AM +, Jin Wang wrote: > Hey David, > > I'm currently using the existing REPL to power the code execution. > Eventually, when Swift becomes more stable and Linux gets more support, we > might be able to do visualisations using UIKit or its alternatives. Right >

Re: [swift-users] [swift-evolution] Plan to move swift-evolution and swift-users mailing lists to Discourse

2017-02-10 Thread Tino Heth via swift-users
> Easy explained - The problem rises indeed not from the added features but > from the fp group that imposes it’s usage in the Standard libraries and “the > swifty way”. I like many features of Swift (or I wouldn’t be here) but I > don’t want to live in Haskel world. And for some reason these

Re: [swift-users] So how do you implement a NSTextStorage subclass in Swift?

2017-02-10 Thread Michel Fortin via swift-users
In case this is useful to someone, this is the workaround I'll be using: ``` class CustomTextStorage: NSTextStorage { private let backingStore: NSMutableAttributedString // This method should never get called from Objective-C as it doesn't respect // the API contract

Re: [swift-users] for with optional collection?

2017-02-10 Thread Tino Heth via swift-users
> Is there any concise way to write the following? > > if let collection = someOptionalCollection > { >for item in collection >{ >} > } I've been thinking about that lately, but haven't had the time to look wether someone on evolution already proposed a "for in?"-loop… Imho the

Re: [swift-users] for with optional collection?

2017-02-10 Thread Maury Markowitz via swift-users
> On Feb 10, 2017, at 10:04 AM, Tino Heth via swift-users > wrote: > > for i in? test { > print(i) > } > > Imho looks even better, but this would need an extension of the language > itself… Oh, yes please! Please post on evolution.