Re: [swift-users] [swift-evolution] Happy new year Swift community.

2017-12-31 Thread David Hart via swift-users
Thank you very much and happy new Swift year to everybody. > On 1 Jan 2018, at 00:42, Adrian Zubarev via swift-evolution > wrote: > > Well some of you guys have to wait a little longer, but I can already wish > everyone a happy new year from Germany. 🎉🎊🎆🎇 > > -- > Adrian Zubarev > Sent with

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 th

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 > wrote: >

[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 a

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 wrote: > >> >> On Jul 28, 2017, at 12:06 AM, David Hart via swift-users >> mailto:swift-users@swift.org>> wrote: >> >> Hello, >> >> Indeed, I had reduced the code too much. John McCall was kind e

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

2017-07-28 Thread David Hart via swift-users
t; > 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 >> mailto:swift-us

[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] ⁨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 local definitions for hash v

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 local definitions for hash v

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 that said functionality

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: UInt8) -> Bool > > Descript

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 current scope? > > We ch

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 wrote: > > Thanks for t

Re: [swift-users] Weird function call behaviour

2017-02-22 Thread David Hart via swift-users
s the class; if you define the extension in a different > module, you’ll get the same behavior you observe below. Sound great :) > Slava > >> >>> Slava >>> >>> >>>> On Feb 22, 2017, at 9:39 AM, David Hart via swift-users >>>>

Re: [swift-users] Weird function call behaviour

2017-02-22 Thread David Hart via swift-users
— there’s nothing > to dynamically dispatch here. We plan on addressing this as part of ABI > stability. What do you mean by “address” this? Force the vtable entry? > Slava > > >> On Feb 22, 2017, at 9:39 AM, David Hart via swift-users >> mailto:swift-users@swift.

[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? >> >> if let collection = someOptionalCollection >> {

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

2017-02-08 Thread David Hart via swift-users
Hi Ted, Thanks so much for taking time to discuss this with the team. I feel very confident this is going to be a big plus for the community :) David > On 9 Feb 2017, at 01:03, Ted kremenek via swift-evolution > wrote: > > Hi everyone, > > There was a long thread on swift-evolution about wh

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 is no ambiguity, no war

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 >> mailto:swift-users@swift.org>>: >> >> You could also fallback to http://swiftdoc.org

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 > w

Re: [swift-users] Performance critical code in Swift

2016-10-02 Thread David Hart via swift-users
That fact that Realm has an ORM layer, and that batch inserts are noticeably slower than in SQLite makes it less performant in certain scenarios. The fact that is does not support JOIN queries also causes issues in other performance scenarios. > On 2 Oct 2016, at 20:26, Marco S Hyman via swift-

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 fileEnumerato

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

2016-08-25 Thread David Hart via swift-users
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 > wrote: > > > On 25 Aug 2016, at 08:23, David Hart via swift-users > wrote

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] What's the relationship between Swift Package Manager and Xcode?

2016-08-02 Thread David Hart via swift-users
If you are only building application bundles for Darwin platforms, have no interest in server Swift, you don’t *need* to look into SPM for now. But as its going to be part of Xcode soon, and if you want to help shape into something you would be interested it, its always worth looking at it now.

Re: [swift-users] try? works on non-method-call?

2016-07-20 Thread David Hart via swift-users
I think that on error or warning like this is the right solution. > On 21 Jul 2016, at 08:13, Sikhapol Saijit via swift-users > wrote: > > 1. Is it intentional that `try?` can be used with non-method-call and return > an optional of the type that follows? _

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

2016-06-09 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 abo

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

2016-06-07 Thread David Hart via swift-users
Thanks for everybody that took the time to fill the form! There were many more responses than I expected, so dinner becomes difficult to organise. But thanks to a hand from another community member, we should have a venue confirmed soon. We are currently shooting for Tuesday evening. More detai

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

2016-06-07 Thread David Hart via swift-users
Hi everybody, After receiving a private question, I'd like to clarify something: I’m hoping that anybody interested in the Swift Open Source project, contributor or not, WWDC ticket holder or not, should feel free to come! This is definitely not something I meant to be restricted in any way. My

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

2016-06-06 Thread David Hart via swift-users
Of course, I wouldn’t want to exclude anybody by default! In that case, I’m proposing dinner somewhere. I’ve setup a Google Forms to help organise it: http://goo.gl/forms/Oq6dK9fPNSCAVfL72 > On 07 Jun 2016, at 08:43, Jacob Bandes-Storch via swift-corelibs

[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 locatio

[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 locatio

Re: [swift-users] Checking/getting custom objects from a collection

2016-04-07 Thread David Hart via swift-users
Unity, the game engine, uses a component system heavily. It uses C# and retrieves components using generic functions. And no, it doesn't force having a single instance of each component class: http://swiftlang.ng.bluemix.net/#/repl/7be36f2d70a31da3b6ab09b7b89277a4463c23b40c28e1663e56c959a1f3eca8

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

2016-01-06 Thread David Hart via swift-users
I can file those bugs. Would it be beneficial if I also created failing unit tests? David. > On 06 Jan 2016, at 20:05, Joe Groff wrote: > >> >> On Jan 5, 2016, at 9:28 AM, David Hart via swift-users >> mailto:swift-users@swift.org>> wrote: >> >>

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

2016-01-06 Thread David Hart via swift-users
to write a proposal to make it less confusing, or if it is a big > with Swift, in which case I should open a bug report. > > David > >> On 05 Jan 2016, at 18:26, David Hart via swift-users >> wrote: >> >> How is it that Swift allows code li

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

2016-01-06 Thread David Hart via swift-users
MyEnum(rawValue: "super") // nil I can't figure out if this is just a confusing behaviour of Swift, in which case I want to write a proposal to make it less confusing, or if it is a big with Swift, in which case I should open a bug report. David > On 05 Jan 2016, at 18:26, D

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 > wrote: > > How is it that Swift allows code like this: > > struct Sneaky: StringLiteralConvertible { > init(stringLiteral value: String) {} > init(extendedGraphemeClus

[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] 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 {

Re: [swift-users] Parameter Validation

2015-12-06 Thread David Hart via swift-users
I’m looking at the special case of library code. If I surface an API in a library, it’s the library user who will call this function. Would you regard this as an assert or throws scenario? > On 07 Dec 2015, at 08:25, Brent Royal-Gordon via swift-users > wrote: > >> When writing library code,