Re: [swift-users] intercept fatalError() or other termination messages from swift?

2017-06-26 Thread David Baraff via swift-users
Ok, the data is for sure not there, or possibly i’m looking at the wrong thing. Here is what I see: Incident Identifier: 15D12BCE-975B-47B6-BD03-DD8512D40DAF CrashReporter Key: 8af1402ae87b0184acff113b3f7312743d94d074 Hardware Model: iPad6,7 Process: hackyApp [4965] Path:

Re: [swift-users] OpenGL function loader for Swift 4

2017-06-26 Thread Taylor Swift via swift-users
The Github repo: https://github.com/kelvin13/swift-opengl On Mon, Jun 26, 2017 at 7:40 PM, Taylor Swift wrote: > Hi all, I have released the Swift *OpenGL* library, a package that lets > you interface with the GPU from Swift code. It’s intended to replace > Turnbull’s >

[swift-users] OpenGL function loader for Swift 4

2017-06-26 Thread Taylor Swift via swift-users
Hi all, I have released the Swift *OpenGL* library, a package that lets you interface with the GPU from Swift code. It’s intended to replace Turnbull’s SGL library which has been unmaintained since the days of Swift 2.0. Swift OpenGL is tested on Linux, it

Re: [swift-users] Extracting arbitrary types (e.g. UInt16) out of Data

2017-06-26 Thread Roderick Mann via swift-users
> On Jun 26, 2017, at 14:05 , Philippe Hausler wrote: > > > >> On Jun 26, 2017, at 1:47 PM, Roderick Mann wrote: >> >>> >>> On Jun 26, 2017, at 10:20 , Charles Srstka wrote: >>> >>> Rats, I was hoping that one of the

Re: [swift-users] Is "lazy let" on the schedule anywhere?

2017-06-26 Thread Slava Pestov via swift-users
If you’re not passing the value type as an inout, how will the ‘lazy let’ property write back the new value? Slava > On Jun 26, 2017, at 3:32 PM, Edward Connell via swift-users > wrote: > > It sure would be nice if the compiler supported lazy lets for structs. Any >

Re: [swift-users] Extracting arbitrary types (e.g. UInt16) out of Data

2017-06-26 Thread Charles Srstka via swift-users
> On Jun 26, 2017, at 3:47 PM, Roderick Mann wrote: > >> On Jun 26, 2017, at 10:20 , Charles Srstka wrote: >> >> Rats, I was hoping that one of the reasons about being so explicit what >> we’re going to access and where with bindMemory() and

Re: [swift-users] Extracting arbitrary types (e.g. UInt16) out of Data

2017-06-26 Thread Philippe Hausler via swift-users
> On Jun 26, 2017, at 1:47 PM, Roderick Mann wrote: > >> >> On Jun 26, 2017, at 10:20 , Charles Srstka > > wrote: >> >> Rats, I was hoping that one of the reasons about being so explicit what >> we’re going

Re: [swift-users] Extracting arbitrary types (e.g. UInt16) out of Data

2017-06-26 Thread Roderick Mann via swift-users
> On Jun 26, 2017, at 10:20 , Charles Srstka wrote: > > Rats, I was hoping that one of the reasons about being so explicit what we’re > going to access and where with bindMemory() and friends would be to take care > of these sorts of issues. > > In that case, the

Re: [swift-users] Extracting arbitrary types (e.g. UInt16) out of Data

2017-06-26 Thread Charles Srstka via swift-users
> On Jun 26, 2017, at 3:41 PM, Roderick Mann wrote: > >> >> On Jun 26, 2017, at 10:20 , Charles Srstka > > wrote: >> >> Rats, I was hoping that one of the reasons about being so explicit what >> we’re going to

Re: [swift-users] Extracting arbitrary types (e.g. UInt16) out of Data

2017-06-26 Thread Roderick Mann via swift-users
> On Jun 26, 2017, at 10:20 , Charles Srstka wrote: > > Rats, I was hoping that one of the reasons about being so explicit what we’re > going to access and where with bindMemory() and friends would be to take care > of these sorts of issues. > > In that case, the

Re: [swift-users] intercept fatalError() or other termination messages from swift?

2017-06-26 Thread David Baraff via swift-users
I will do a few more crashes, by doing a fatalError() and also unwrapping an optional or something, and see if I can see them. THanks for telling me where to look. I’ll let you know what I find. Begin forwarded message: > From: Joe Groff > Subject: Re: [swift-users]

Re: [swift-users] intercept fatalError() or other termination messages from swift?

2017-06-26 Thread David Baraff via swift-users
Begin forwarded message: > From: Jon Shier > Subject: Re: [swift-users] intercept fatalError() or other termination > messages from swift? > Date: June 26, 2017 at 12:30:50 PM PDT > To: David Baraff > Cc: Joe Groff , swift-users

Re: [swift-users] intercept fatalError() or other termination messages from swift?

2017-06-26 Thread Joe Groff via swift-users
> On Jun 26, 2017, at 12:22 PM, David Baraff wrote: > > To be very clear, i’m concerned about iOS not mac os x. I pulled up a crash > report using xcode tools, and saw no mention of the string output by fatal > error. If there is someway after the fact of, on an

[swift-users] Is "lazy let" on the schedule anywhere?

2017-06-26 Thread Edward Connell via swift-users
It sure would be nice if the compiler supported lazy lets for structs. Any idea when or if this will be supported? Seems like a nice performance win, lazy var is a pain because you can't access arguments passed into a function without mutation complaints. Thanks, Ed

Re: [swift-users] Is "lazy let" on the schedule anywhere?

2017-06-26 Thread Adrian Zubarev via swift-users
I myself highly want lazy constants (I’m tired of writing something like file private private(set) lazy var propertyName: ReferenceType just to hide the setter from the rest of the codebase), but I don’t think this will ever happen in Swift, at least not as an improvement for the lazy keyword

Re: [swift-users] intercept fatalError() or other termination messages from swift?

2017-06-26 Thread David Baraff via swift-users
To be very clear, i’m concerned about iOS not mac os x. I pulled up a crash report using xcode tools, and saw no mention of the string output by fatal error. If there is someway after the fact of, on an iPhone or iOS interogating the asl_log when you restart your program to glean the error

Re: [swift-users] Extracting arbitrary types (e.g. UInt16) out of Data

2017-06-26 Thread Joe Groff via swift-users
> On Jun 26, 2017, at 10:05 AM, Philippe Hausler wrote: > > Data.copyBytes will do that under the hood > > var crc: UInt16 = 0 > let amountCopied = withUnsafeMutablePointer(to: ) { data.copyBytes(to: > UnsafeMutableBufferPointer(start: $0, count: 1)) } > if amountCopied ==

Re: [swift-users] Extracting arbitrary types (e.g. UInt16) out of Data

2017-06-26 Thread Charles Srstka via swift-users
> On Jun 26, 2017, at 12:58 PM, Joe Groff wrote: > >> >> On Jun 26, 2017, at 10:20 AM, Charles Srstka via swift-users >> > wrote: >> >> Rats, I was hoping that one of the reasons about being so explicit what >> we’re

Re: [swift-users] Extracting arbitrary types (e.g. UInt16) out of Data

2017-06-26 Thread Joe Groff via swift-users
> On Jun 26, 2017, at 10:20 AM, Charles Srstka via swift-users > wrote: > > Rats, I was hoping that one of the reasons about being so explicit what we’re > going to access and where with bindMemory() and friends would be to take care > of these sorts of issues. There

Re: [swift-users] Swift 4 thread sanitizer more sensitive?

2017-06-26 Thread Joe Groff via swift-users
> On Jun 26, 2017, at 10:33 AM, Joe Groff via swift-users > wrote: > > >> On Jun 25, 2017, at 3:56 PM, Jon Shier via swift-users >> wrote: >> >> Running Alamofire through the thread sanitizer and the thread sanitizer >> finds issues in

Re: [swift-users] Swift 4 thread sanitizer more sensitive?

2017-06-26 Thread Joe Groff via swift-users
> On Jun 25, 2017, at 3:56 PM, Jon Shier via swift-users > wrote: > > Running Alamofire through the thread sanitizer and the thread sanitizer > finds issues in Swift 4 mode but not Swift 3.2. Does Swift 4 add additional > threading instrumentation that you don’t

Re: [swift-users] Extracting arbitrary types (e.g. UInt16) out of Data

2017-06-26 Thread Philippe Hausler via swift-users
> On Jun 26, 2017, at 10:20 AM, Charles Srstka wrote: > > Rats, I was hoping that one of the reasons about being so explicit what we’re > going to access and where with bindMemory() and friends would be to take care > of these sorts of issues. > > In that case, the

Re: [swift-users] Extracting arbitrary types (e.g. UInt16) out of Data

2017-06-26 Thread Charles Srstka via swift-users
Rats, I was hoping that one of the reasons about being so explicit what we’re going to access and where with bindMemory() and friends would be to take care of these sorts of issues. In that case, the simplest way to do it is probably just this: let crc = (UInt16(myData[myData.endIndex]) << 8)

Re: [swift-users] Extracting arbitrary types (e.g. UInt16) out of Data

2017-06-26 Thread Philippe Hausler via swift-users
Data.copyBytes will do that under the hood var crc: UInt16 = 0 let amountCopied = withUnsafeMutablePointer(to: ) { data.copyBytes(to: UnsafeMutableBufferPointer(start: $0, count: 1)) } if amountCopied == MemoryLayout.size { // we have a full crc } That will probably do what you want; plus

Re: [swift-users] intercept fatalError() or other termination messages from swift?

2017-06-26 Thread Joe Groff via swift-users
> On Jun 23, 2017, at 9:13 PM, David Baraff via swift-users > wrote: > > I realize this is slightly centric to iOS, but it irks me that both Apple’s > crash report logs and popular platforms like PLCrashReporter can do the hard > stuff like give you a stack trace, but

Re: [swift-users] Extracting arbitrary types (e.g. UInt16) out of Data

2017-06-26 Thread Joe Groff via swift-users
> On Jun 26, 2017, at 1:55 AM, Daniel Vollmer via swift-users > wrote: > > Hi Rick, > >> On 26. Jun 2017, at 02:37, Rick Mann via swift-users >> wrote: > > [snip] > >> I'd also like to avoid unnecessary copying of the data. All of it is >>

Re: [swift-users] Extracting arbitrary types (e.g. UInt16) out of Data

2017-06-26 Thread Charles Srstka via swift-users
> On Jun 26, 2017, at 3:55 AM, Daniel Vollmer via swift-users > wrote: > > Hi Rick, > >> On 26. Jun 2017, at 02:37, Rick Mann via swift-users > > wrote: > > [snip] > >> I'd also like to avoid unnecessary copying of

Re: [swift-users] JSON keys survey

2017-06-26 Thread Abdullah Khan via swift-users
this article is a good starting point; http://benscheirman.com/2017/06/ultimate-guide-to-json-parsing-with-swift-4/ > On Jun 23, 2017, at 9:42 AM, Tony Parker via swift-users > wrote: > >

[swift-users] Swift Language Research References

2017-06-26 Thread Eric Dahlseng via swift-users
Hello, I’m curious to learn more about why many design decisions in Swift were chosen. Apple’s website says that "Swift is the result of the latest research on programming languages,” but I can’t find any more information on this research. Are there any references available? Thank you, Eric

[swift-users] Very large NSNumber values

2017-06-26 Thread Rien via swift-users
I was working with very large NSNumber values and noticed some odd behaviour when converting these values to integers. An NSNumber with the value +1e+40 will when converted to Ints produce integers wit the value zero for Int8, UInt8, Int16, UInt16, Int32 and UInt32. But for Int64 it will

Re: [swift-users] Extracting arbitrary types (e.g. UInt16) out of Data

2017-06-26 Thread Roderick Mann via swift-users
Thanks, I'll give that a try. > On Jun 25, 2017, at 23:11 , Charles Srstka wrote: > >> On Jun 26, 2017, at 12:00 AM, Roderick Mann via swift-users >> wrote: >> >> I mean, it's as straightforward as my example. I have a Data of arbitrary >>

Re: [swift-users] Extracting arbitrary types (e.g. UInt16) out of Data

2017-06-26 Thread Daniel Vollmer via swift-users
Hi Rick, > On 26. Jun 2017, at 02:37, Rick Mann via swift-users > wrote: [snip] > I'd also like to avoid unnecessary copying of the data. All of it is > immutable for the purposes of this problem. > > How can I get the UInt16 that starts at byte X in a Data? Same goes

Re: [swift-users] Extracting arbitrary types (e.g. UInt16) out of Data

2017-06-26 Thread Charles Srstka via swift-users
> On Jun 26, 2017, at 12:00 AM, Roderick Mann via swift-users > wrote: > > I mean, it's as straightforward as my example. I have a Data of arbitrary > size (anywhere from 3 to 29 bytes, let's say). The last two bytes form a > UInt16 CRC. I need to get those last two out

Re: [swift-users] Extracting arbitrary types (e.g. UInt16) out of Data

2017-06-26 Thread Charles Srstka via swift-users
> On Jun 26, 2017, at 1:11 AM, Charles Srstka via swift-users > wrote: > >> On Jun 26, 2017, at 12:00 AM, Roderick Mann via swift-users >> > wrote: >> >> I mean, it's as straightforward as my example. I have a Data of