Re: [swift-users] Cannot pass immutable value as inout argument

2018-01-17 Thread Geordie Jay via swift-users
Jordan Rose via swift-users schrieb am Mi. 17. Jan. 2018 um 01:38: > Oh no, you're right, I'm sorry. You can only do that with arrays at the > moment. We do have a bug for this already. > > Jordan > But couldn’t you call it like this: lgs_notify_params_t(notify: [lgs_notify_did_enter_background

Re: [swift-users] A problem about interact with C macros

2017-12-17 Thread Geordie Jay via swift-users
debugging nightmare. Since there is no “right” answer, I’d say macro expressions like this will never be imported by Swift. - Geordie Geordie Jay via swift-users schrieb am So. 17. Dez. 2017 um 14:40: > I think this is because the C preprocessor will interpret SITUATIONALL not > as a value but

Re: [swift-users] A problem about interact with C macros

2017-12-17 Thread Geordie Jay via swift-users
I think this is because the C preprocessor will interpret SITUATIONALL not as a value but as an expression. That means your C code at that spot will be turned into “(SITUATION1 | SITUATION2 | etc)” and not into the result of that expression directly. The clang importer could probably figure this o

Re: [swift-users] Was the String contains(_:) method changed in Swift 4?

2017-11-08 Thread Geordie Jay via swift-users
Jens Alfke schrieb am Mi. 8. Nov. 2017 um 16:54: > > > On Nov 8, 2017, at 2:24 AM, Geordie Jay via swift-users < > swift-users@swift.org> wrote: > > Would you be able to clarify where the line is between “tricky” and “not > tricky” and if possible the reasoning beh

Re: [swift-users] Was the String contains(_:) method changed in Swift 4?

2017-11-08 Thread Geordie Jay via swift-users
Quinn "The Eskimo!" via swift-users schrieb am Mi. 8. Nov. 2017 um 09:56: > > On 8 Nov 2017, at 08:47, Martin R via swift-users > wrote: > > > but apparently only if Foundation is imported. > > Which isn’t a huge surprise when you consider how tricky string > containment is. As someone who has

Re: [swift-users] dealing with heterogenous lists/dictionary with Codable

2017-10-19 Thread Geordie Jay via swift-users
David Baraff schrieb am Do. 19. Okt. 2017 um 21:35: > > > Begin forwarded message: > > From: Geordie Jay > > Subject: Re: [swift-users] dealing with heterogenous lists/dictionary with > Codable > > Date: October 19, 2017 at 12:24:44 PM PDT > > To: David Baraff , Itai Ferber > > Cc: swift-users

Re: [swift-users] dealing with heterogenous lists/dictionary with Codable

2017-10-19 Thread Geordie Jay via swift-users
David Baraff schrieb am Do. 19. Okt. 2017 um 21:14: > My apologies. I misstated the problem: I don’t want to just limit to Int, > String, [Int], etc. but also allow structures where > > struct NewThingy : Codable { > let data1: T1 > let data2: T2 > } > > where T1 and T2 are themselves Codable. >

Re: [swift-users] dealing with heterogenous lists/dictionary with Codable

2017-10-19 Thread Geordie Jay via swift-users
I mean can you do something along the lines of let codableDict = stringAnyDict as? [String : Codable] ? I’m not at a computer to test it myself David Baraff schrieb am Do. 19. Okt. 2017 um 15:45: > That’s exactly what I want. The ironic part is that I got my dictionary > by decoding a Jso

Re: [swift-users] dealing with heterogenous lists/dictionary with Codable

2017-10-19 Thread Geordie Jay via swift-users
David Baraff via swift-users schrieb am Do. 19. Okt. 2017 um 03:47: > So I have simple structs like this: > > struct Library: Codable { > let domain: String > let unit: String > } > > and it’s super-simple to serialize. Yay. > > But: > > st

Re: [swift-users] Why does the withUnsafeMutableBufferPointer closure take an inout parameter?

2017-10-14 Thread Geordie Jay via swift-users
Chris Lattner schrieb am Sa. 14. Okt. 2017 um 05:18: > > On Oct 13, 2017, at 7:40 PM, Andrew Trick via swift-users < > swift-users@swift.org> wrote: > > > > On Oct 12, 2017, at 3:52 AM, Geordie Jay via swift-users < > swift-users@swift.org> wrote: > > &g

Re: [swift-users] Why does the withUnsafeMutableBufferPointer closure take an inout parameter?

2017-10-12 Thread Geordie Jay via swift-users
Guillaume Lessard via swift-users schrieb am Mi. 11. Okt. 2017 um 23:49: > A lot of the MutableCollection implementation is in protocol extensions > (swapAt, for example.) > > Should an additional version be written just for the Unsafe*BufferPointer > types? Makes sense to me, given the example

Re: [swift-users] [Feature Request] Extend the `defer` statement

2017-10-09 Thread Geordie Jay via swift-users
This feature request is probably one for swift evolution. I like the idea in theory, but I’d prefer to see the return value identifier being spelled out, i.e. “returnValue” instead of the symbols. Jun Zhang via swift-users schrieb am Mo. 9. Okt. 2017 um 05:37: > Yes that's true, but this requir

Re: [swift-users] Communicating with dynamically loaded swift library

2017-10-07 Thread Geordie Jay via swift-users
Ján Kosa schrieb am Sa. 7. Okt. 2017 um 15:27: > I tried to use @_exported and it helped somewhat. While I still have same > warnings, size of the PluginInterface library went down by 6mb (to 120kb) > so it looks like Protobuf is no longer statically linked to it. However, > size of PluginConsume

Re: [swift-users] Communicating with dynamically loaded swift library

2017-10-07 Thread Geordie Jay via swift-users
Ján Kosa schrieb am Sa. 7. Okt. 2017 um 13:34: > I tried swift package clean, but it didn't help > > "Try to ensure the plugin provider module (libA) is (only) being compiled > into its standalone shared library file." > How do I go about this? It is 3rd party module, it doesn't define any > prod

Re: [swift-users] Communicating with dynamically loaded swift library

2017-10-06 Thread Geordie Jay via swift-users
I think SwiftPM is (incorrectly) compiling A.XYZ into each of the modules that depend on it, as well as into your intended libA.so file. Try to ensure the plugin provider module (libA) is (only) being compiled into its standalone shared library file. Try cleaning the swiftpm build for one (swift p

Re: [swift-users] Is URLSession actually working on Linux

2017-10-03 Thread Geordie Jay via swift-users
2017-10-03 20:10 GMT+02:00 Georgios Moschovitis via swift-users < swift-users@swift.org>: > I implemented a simple RSS feed aggregator. I used code like... > > let data = try! Data(contentsOf: feedURL) > > or > > let session = URLSession(configuration: URLSessionConfiguration.default) > let task =

Re: [swift-users] Problem with Access Control and Extensions

2017-09-21 Thread Geordie Jay via swift-users
Adrian Zubarev via swift-users schrieb am Mi. 20. Sep. 2017 um 22:13: > I don’t get your problem here. If you don’t want to debate the correctness > of your code, why are you asking for help or even showing error messages > for a code snippet that cannot work? > > 1. Drop the access modifier from

Re: [swift-users] Swift 4 "Cannot use mutating member on immutable value: 'self' is immutable"

2017-09-18 Thread Geordie Jay via swift-users
It seems to me that some of these concerns could be fixed by returning ArraySlice instead of Array on popFirst(). Then you’d have similar performance expectations and explicit copying like with String / Substring. Geordie Elia Cereda via swift-users schrieb am Mo. 18. Sep. 2017 um 11:12: > NSM

Re: [swift-users] [swift-evolution] How does "Sequence.joined" work?

2017-08-08 Thread Geordie Jay via swift-users
Daryle Walker via swift-evolution schrieb am Di. 8. Aug. 2017 um 21:25: > On Aug 8, 2017, at 12:35 AM, Félix Cloutier > wrote: > > All this means is that `joined()` does not create an array that contains > the new result. It's only as magic as the COW semantics on arrays. > > > So you’re saying

Re: [swift-users] SwiftPM manual dependency management

2017-07-22 Thread Geordie Jay via swift-users
Hi Ankit, thanks for your explanations. Ankit Aggarwal schrieb am Sa. 22. Juli 2017 um 13:44: > On 22-Jul-2017, at 3:37 PM, Geordie Jay wrote: > > > Geordie J schrieb am Fr. 21. Juli 2017 um 14:39: > >> Hi Ankit, thanks for your reply. >> >> Am 21.07.2017 um 07:33 schrieb Ankit Aggarwal via sw

Re: [swift-users] SwiftPM manual dependency management

2017-07-22 Thread Geordie Jay via swift-users
Geordie J schrieb am Fr. 21. Juli 2017 um 14:39: > Hi Ankit, thanks for your reply. > > Am 21.07.2017 um 07:33 schrieb Ankit Aggarwal via swift-users < > swift-users@swift.org>: > > > > On Thu, Jul 20, 2017 at 10:34 PM, Geordie J via swift-users < > swift-users@swift.org> wrote: > >> Hi all, >> >

Re: [swift-users] Should I be using more catchless do blocks?

2017-06-20 Thread Geordie Jay via swift-users
Sorry in advance if Google Inbox messes with my code formatting below (can't there be just one good email client? I miss Mailbox) Michael Savich via swift-users schrieb am Mo. 19. Juni 2017 um 20:54: > Yeah, it's all about balance to be sure. Though one benefit of do blocks > is in functions tha

Re: [swift-users] Compile time exceeded. Anything wrong?

2017-06-05 Thread Geordie Jay via swift-users
I doubt it'll be "fixed" in the next release (which came out less than 24 hours ago), but I gather type checker speed optimisations and fixing crashes are ongoing goals of the compiler team. With no guarantees or expectations, you may find your code compiles in an acceptable time with Swift 4 (Xcod

Re: [swift-users] Calling default implementation of protocol methods as selectors

2017-06-03 Thread Geordie Jay via swift-users
That's why I thanked for for the amendment. As I said, typing code blindly on the phone, mistakes are inevitable. Thanks for clearing it up. On Sun 4. Jun 2017 at 15:04, Zhao Xin wrote: > I was not talking about the formatting. I am talking about the > implementation. > > You can't use `self` bef

Re: [swift-users] Calling default implementation of protocol methods as selectors

2017-06-03 Thread Geordie Jay via swift-users
Thanks for the amendment, and sorry for the (lack of) formatting. I painstakingly typed that on my phone with manually-spaced indenting, which the Inbox app unhelpfully removed entirely when I pressed send. Pasting into Xcode should do the trick though.. Geordie On Sun 4. Jun 2017 at 14:49, Zhao X

Re: [swift-users] Calling default implementation of protocol methods as selectors

2017-06-03 Thread Geordie Jay via swift-users
I am dealing with a variant of this on Android right now. I have just subclassed e.g. UITapGestureRecognizer to perform the 2nd variant above and externally accept a closure as its argument. I'm writing this on my phone so forgive any syntax errors or accidental omissions: class TapGestureRecogniz

Re: [swift-users] Annotating C APIs without changing the original header files

2017-05-14 Thread Geordie Jay via swift-users
Cheers, Geordie Daniel Dunbar schrieb am Fr. 12. Mai 2017 um 20:33: > We don't have explicit support for api notes in SwiftPM. > Does that mean there is "unexplicit" support (maybe via swift build command line arguments)? I don't mind if I have to make a build script, but it'd be a major code

Re: [swift-users] Annotating C APIs without changing the original header files

2017-05-07 Thread Geordie Jay via swift-users
I'm having the same issue. The renames seem to work, as in they disappear from the global scope with a fixit to rename to the new (namespaced) version if I type in the name manually, but they don't appear as static members of the enum type, regardless of how I call them. Would appreciate some help

Re: [swift-users] Annotating C APIs without changing the original header files

2017-05-04 Thread Geordie Jay via swift-users
Fantastic! Thanks for the info, this is great news. While I have you, I'm interested in annotating function pointers. Specifically, the JNI environment instance is a pointer to a pointer, so as is you have to type env.pointee.pointee.FunctionName(env, param1, param2) Ideally this would just look

Re: [swift-users] Annotating C APIs without changing the original header files

2017-05-04 Thread Geordie Jay via swift-users
Great, thanks for reminding me of this feature. I couldn't see how it could be used outside of the stdlib though, is it possible to use apinotes when simply linking a C module via its modulemap ? Douglas Gregor schrieb am Fr. 5. Mai 2017 um 01:55: > > On May 3, 2017, at 4:10 PM, Geordie J via swi