Re: [swift-users] Very strange automatic behavior between StringLiteralConvertible and pattern matching

2016-01-05 Thread David Hart via swift-users
Sorry about the double post. > On 05 Jan 2016, at 18:26, David Hart via swift-users <swift-users@swift.org> > wrote: > > How is it that Swift allows code like this: > > struct Sneaky: StringLiteralConvertible { > init(stringLiteral val

[swift-users] Very unexpected automatic behaviour between StringLiteralConvertible and pattern matching!

2016-01-05 Thread David Hart via swift-users
How is it that Swift allows code like this: struct Sneaky: StringLiteralConvertible { init(stringLiteral value: String) {} init(extendedGraphemeClusterLiteral value: String) {} init(unicodeScalarLiteral value: String) {} } func ~=(sneaky: Sneaky, string: String) -> Bool {

[swift-users] Very strange automatic behavior between StringLiteralConvertible and pattern matching

2016-01-05 Thread David Hart via swift-users
How is it that Swift allows code like this: struct Sneaky: StringLiteralConvertible { init(stringLiteral value: String) {} init(extendedGraphemeClusterLiteral value: String) {} init(unicodeScalarLiteral value: String) {} } func ~=(sneaky: Sneaky, string: String) -> Bool {

[swift-users] WWDC Meetup

2016-06-06 Thread David Hart via swift-users
I imagine that during WWDC a non-negligible proportion of the Swift Open Source contributors will be in or around San-Francisco. I’d very much like to profit from that opportunity to meet-up, get to know each other, talk Swift over some beers! Is anybody interested? If yes, any ideas for

[swift-users] WWDC Meetup

2016-06-06 Thread David Hart via swift-users
I imagine that during WWDC a non-negligible proportion of the Swift Open Source contributors will be in or around San-Francisco. I’d very much like to profit from that opportunity to meet-up, get to know each other, talk Swift over some beers! Is anybody interested? If yes, any ideas for

Re: [swift-users] [swift-corelibs-dev] [swift-evolution] WWDC Meetup

2016-06-10 Thread David Hart via swift-users
Hi all, I have some news on the WWDC meet-up that was announced earlier this week. Thanks to the help of a friendly community member, Bert Belder, we have been able to secure a very cool venue! The meetup will take place on Tuesday, June 14th at 7pm, in the IBM Bluemix Garage, which is at

[swift-users] Weird function call behaviour

2017-02-22 Thread David Hart via swift-users
In the following piece of code, can somebody explain the last result? Why the break in consistency? Is this a bug? protocol P { func foo() -> String } extension P { func foo() -> String { return "P" } } class A : P { func foo() -> String { return "A" } } class B : P {}

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

2017-02-09 Thread David Hart via swift-users
someOptionalCollection?.forEach { item in } > On 9 Feb 2017, at 22:48, Marco S Hyman via swift-users > wrote: > > >> On Feb 9, 2017, at 1:26 PM, Rick Mann via swift-users >> wrote: >> >> Is there any concise way to write the following? >> >>

Re: [swift-users] Regression in Xcode8-beta6 Swift?

2016-08-25 Thread David Hart via swift-users
I misunderstood the release notes for Xcode 8 beta 6 I read a few days ago. Here what will interest you: Since ‘id’ now imports as ‘Any’ rather than ‘AnyObject’, you may see errors where you were previously performing dynamic lookup on ‘AnyObject’. For example in: guard let

Re: [swift-users] Regression in Xcode8-beta6 Swift?

2016-08-25 Thread David Hart via swift-users
You can’t call arbitrary functions on AnyObject anymore. Previously, you could do this: let a: AnyObject = UIView() a.hasPrefix(“test”) // This compiled (because hasPrefix(:_) exists on NSString), but would obviously crash This is not allowed anymore. > On 25 Aug 2016, at 03:33, Travis Griggs

Re: [swift-users] Regression in Xcode8-beta6 Swift?

2016-08-25 Thread David Hart via swift-users
nt at all. What was decided concerning that? I felt sure that the lookup had been completely removed, but I’m obviously mistaken. David. > On 25 Aug 2016, at 09:59, Quinn The Eskimo! via swift-users > <swift-users@swift.org> wrote: > > > On 25 Aug 2016, at 08:23, David Hart vi

Re: [swift-users] How to be DRY on ranges and closed ranges?

2016-10-12 Thread David Hart via swift-users
I’ve been bitten by that quite a few times. I’m not a fan of the new distinction between Range and ClosedRange. I understand the reasoning behind them, but the new model is creating more problems for me than the it solves. David. > On 12 Oct 2016, at 12:21, Jean-Denis Muys via swift-users >

Re: [swift-users] find std lib doc

2016-10-12 Thread David Hart via swift-users
Dash + Alfred :) > On 12 Oct 2016, at 17:13, Lars-Jørgen Kristiansen via swift-users > wrote: > > I recommend Dash  > >> 12. okt. 2016 kl. 17.03 skrev Adrian Zubarev via swift-users >> >: >> >> You could also

Re: [swift-users] Compiler should issue a warning when a subclass implementation with default values matches a parent implementation without them

2017-01-09 Thread David Hart via swift-users
I think we need a warning because it is definitely ambiguous and a common pitfall for users of an API. The only solution would be for the APIs be written so to avoid those ambiguities I think. > On 5 Jan 2017, at 08:58, Rien via swift-users wrote: > > As you know. there

Re: [swift-users] Improving compilation times?

2017-03-23 Thread David Hart via swift-users
Yes, it's best to avoid concatenating strings with +. Not only for performance reasons, but it's also less readable than string interpolation: str += "No: \(count), HostIp: \(clientIp ?? "?") at port: \(service ?? "?")\n" > On 23 Mar 2017, at 08:11, Rien via swift-users

Re: [swift-users] Law of Exclusivity runtime false positive?

2017-07-30 Thread David Hart via swift-users
> On 28 Jul 2017, at 18:55, Joe Groff <jgr...@apple.com> wrote: > >> >> On Jul 28, 2017, at 12:06 AM, David Hart via swift-users >> <swift-users@swift.org <mailto:swift-users@swift.org>> wrote: >> >> Hello, >> >> Indeed, I

Re: [swift-users] ⁨Is it possible to store a set of heterogeneous items with protocol?

2017-07-19 Thread David Hart via swift-users
> On 19 Jul 2017, at 09:22, Glen Huang via swift-users > wrote: > > Thanks for the heads up. > > I wonder what’s the root cause of the difficulty to make "such an existential > conform to Hashable in a general way”. Is it because objects of different > types have

Re: [swift-users] ⁨Is it possible to store a set of heterogeneous items with protocol?

2017-07-19 Thread David Hart via swift-users
> On 19 Jul 2017, at 09:22, Glen Huang via swift-users > wrote: > > Thanks for the heads up. > > I wonder what’s the root cause of the difficulty to make "such an existential > conform to Hashable in a general way”. Is it because objects of different > types have

[swift-users] Law of Exclusivity runtime false positive?

2017-07-27 Thread David Hart via swift-users
Hello, In Xcode 9 beta 4, Swift 4, I’m getting runtime errors popping up for Simultaneous accesses and I think they may be false negatives. Here’s a stripped down version of my code: class MyButton: UIButton { fileprivate var imageRect: CGRect = .zero fileprivate var titleRect:

Re: [swift-users] Law of Exclusivity runtime false positive?

2017-07-28 Thread David Hart via swift-users
e. For example: > > var spacing: CGFloat { > return imageRect.maxX > } > > Without doing something like that, I don't see the same access conflicts that > you're seeing. > > -Kyle > >> On Jul 27, 2017, at 5:04 AM, David Hart via swift-users >

Re: [swift-users] Decode a JSON object of unknown format into a Dictionary with Decodable in Swift 4

2017-06-23 Thread David Hart via swift-users
> On 23 Jun 2017, at 03:45, Jon Shier via swift-users > wrote: > > I’m sorry, are you complaining about my use of Codable instead of more > precisely referring to the JSON endcode/decode functionality based on it in > Foundation, or are you honestly trying to say

Re: [swift-users] Runtime crash caused by (NS)CharacterSet.hasMember?

2017-06-13 Thread David Hart via swift-users
Worth a radar to improve docs. > On 13 Jun 2017, at 22:12, Jens Persson via swift-users > wrote: > > Thanks! > > The documentation that Xcode displays (for CharacterSet's hasMember(inPlane > plane:)) is as follows: > > Declaration: > func hasMember(inPlane plane:

Re: [swift-users] swift 4.0 "swift-version 4" errors with "type(of:"

2017-05-19 Thread David Hart via swift-users
That's worrisome. type is such a common identifier that I worry its going to break a lot of code, create some confusion and force the un-esthetic qualifying. > On 19 May 2017, at 21:38, Slava Pestov via swift-users > wrote: > > Do you have a member named ‘type’ in the

[swift-users] Broken Syntax Highlighting + Code Completion

2017-08-30 Thread David Hart via swift-users
Hi everybody, I have a 99% pure Swift 4 project (1% of Objective-C) in Xcode 9 beta 6 and the syntax highlighting and code completion is completely broken. I’m writing here in case it’s a Swift problem and unrelated to Xcode. Jordan Rose suggested I run Xcode with SOURCEKIT_LOGGING=2 and here

Re: [swift-users] Type of expression is ambiguous for static tuples

2017-09-01 Thread David Hart via swift-users
Its slightly different though. In the case of: let cgColor: CGColor = .clear.cgColor clear is a static property on UIColor, not CGColor. In his example, pythagoreanTriple is a property on Double so it does feel like a bug. > On 1 Sep 2017, at 13:31, Adrian Zubarev via swift-users >

Re: [swift-users] I ve found a serious Bug in JSONEncoder (SR-6131) and would like to fix it.

2017-12-18 Thread David Hart via swift-users
Hello! Thanks for noticing a bug and taking the time to fix it :) Here are the steps for contributing: Fork the project (you’ve already done that). Clone the fork to your computer. Branch off master and name the branch after the fix (I like to name them with the sr number). Write the fix and