Re: [swift-evolution] Pitch: Improved Swift pointers

2017-07-14 Thread Taylor Swift via swift-evolution
For the sake of argument, I’m gonna claim that instead, UnsafeMutableBufferPointer is the low level necessity, and UnsafeMutablePointer is the low level convenience structure. Suppose that every block of memory has a starting point, and a length. An UnsafeBufferPointer represents that, since all a

Re: [swift-evolution] Change default compiler fix for not-unwrapped Optional from ! To ?

2017-07-14 Thread Robert Bennett via swift-evolution
For expressions whose type is definitely non-optional, it makes sense to verbally suggest both ! and ?? (and/or !! – was that accepted?), and it’s probably best to insert ! when the fixit is accepted. For expressions whose type is undetermined, but which need some form of Optional handling, it w

Re: [swift-evolution] [Review] SE-0181: Package Manager C/C++ Language Standard Support

2017-07-14 Thread Xiaodi Wu via swift-evolution
On Tue, Jul 11, 2017 at 12:54 PM, Daniel Dunbar via swift-evolution < swift-evolution@swift.org> wrote: > Hello Swift community, > > The review of *SE-0181: Package Manager C/C++ Language Standard Support* > begins > now and runs through *July 14th, 2017*. > > The proposal is available here: > >

Re: [swift-evolution] Pitch: Wrap calls to NSFileHandle and NSData in autorelease pools

2017-07-14 Thread Charles Srstka via swift-evolution
> On Jul 14, 2017, at 3:56 PM, John McCall wrote: > > >> On Jul 14, 2017, at 4:43 PM, Charles Srstka > > wrote: >> >>> On Jul 14, 2017, at 3:40 PM, John McCall >> > wrote: >>> >>> Would you mind just filing a bug with a reduced test c

Re: [swift-evolution] Pitch: Wrap calls to NSFileHandle and NSData in autorelease pools

2017-07-14 Thread John McCall via swift-evolution
> On Jul 14, 2017, at 4:43 PM, Charles Srstka wrote: > >> On Jul 14, 2017, at 3:40 PM, John McCall > > wrote: >> >> Would you mind just filing a bug with a reduced test case? >> >> John. > > Radar or bugs.swift.org ? Either would be fine, as

Re: [swift-evolution] Pitch: Wrap calls to NSFileHandle and NSData in autorelease pools

2017-07-14 Thread Philippe Hausler via swift-evolution
> On Jul 14, 2017, at 1:40 PM, John McCall via swift-evolution > wrote: > >> On Jul 14, 2017, at 4:31 PM, Charles Srstka > > wrote: >>> On Jul 14, 2017, at 3:24 PM, John McCall >> > wrote: >>> >>> We should absolutely not need to do

Re: [swift-evolution] Pitch: Wrap calls to NSFileHandle and NSData in autorelease pools

2017-07-14 Thread Charles Srstka via swift-evolution
> On Jul 14, 2017, at 3:40 PM, John McCall wrote: > > Would you mind just filing a bug with a reduced test case? > > John. Radar or bugs.swift.org ? Charles ___ swift-evolution mailing list swift-evolution@swift.org https://l

Re: [swift-evolution] Pitch: Wrap calls to NSFileHandle and NSData in autorelease pools

2017-07-14 Thread Charles Srstka via swift-evolution
> On Jul 14, 2017, at 3:24 PM, John McCall wrote: > > We should absolutely not need to do the later autoreleases. We have logic to > autorelease objects when calling returns-inner-pointer objects on them, but > we shouldn't need to do that in safe patterns like what Data does here by > scopin

Re: [swift-evolution] Pitch: Wrap calls to NSFileHandle and NSData in autorelease pools

2017-07-14 Thread John McCall via swift-evolution
> On Jul 14, 2017, at 4:15 PM, Charles Srstka wrote: > >> On Jul 14, 2017, at 2:35 PM, John McCall > > wrote: >> >>> On Jul 14, 2017, at 1:12 PM, Charles Srstka via swift-evolution >>> mailto:swift-evolution@swift.org>> wrote: >>> MOTIVATION: >>> >>> Meet Bob. Bob i

Re: [swift-evolution] Pitch: Wrap calls to NSFileHandle and NSData in autorelease pools

2017-07-14 Thread John McCall via swift-evolution
> On Jul 14, 2017, at 4:31 PM, Charles Srstka wrote: >> On Jul 14, 2017, at 3:24 PM, John McCall > > wrote: >> >> We should absolutely not need to do the later autoreleases. We have logic >> to autorelease objects when calling returns-inner-pointer objects on them, >

Re: [swift-evolution] Pitch: Wrap calls to NSFileHandle and NSData in autorelease pools

2017-07-14 Thread Charles Srstka via swift-evolution
> On Jul 14, 2017, at 2:35 PM, John McCall wrote: > >> On Jul 14, 2017, at 1:12 PM, Charles Srstka via swift-evolution >> mailto:swift-evolution@swift.org>> wrote: >> MOTIVATION: >> >> Meet Bob. Bob is a developer with mostly C++ and Java experience, but who >> has been learning Swift. Bob nee

Re: [swift-evolution] Pitch: Wrap calls to NSFileHandle and NSData in autorelease pools

2017-07-14 Thread John McCall via swift-evolution
> On Jul 14, 2017, at 1:12 PM, Charles Srstka via swift-evolution > wrote: > MOTIVATION: > > Meet Bob. Bob is a developer with mostly C++ and Java experience, but who has > been learning Swift. Bob needs to write an app to parse some proprietary > binary data format that his company requires.

Re: [swift-evolution] Change default compiler fix for not-unwrapped Optional from ! To ?

2017-07-14 Thread Erica Sadun via swift-evolution
> On Jul 14, 2017, at 2:11 AM, Víctor Pimentel via swift-evolution > wrote: > >> On 14 Jul 2017, at 08:05, Rod Brown via swift-evolution >> wrote: >> >> >> >>> On 14 Jul 2017, at 2:36 pm, Robert Bennett via swift-evolution >>> wrote: >>> >>> When writing Swift code, it is not uncommon t

Re: [swift-evolution] Pitch: Improved Swift pointers

2017-07-14 Thread Andrew Trick via swift-evolution
> On Jul 14, 2017, at 11:27 AM, Michael Ilseman wrote: > >> I also have to say it’s not common to deallocate something in Swift that you >> didn’t previously allocate in Swift. >> > > I’m not sure it is even defined to use `deallocate` on memory that wasn’t > `allocated` in Swift. Andy, tho

Re: [swift-evolution] Pitch: Improved Swift pointers

2017-07-14 Thread Michael Ilseman via swift-evolution
> On Jul 13, 2017, at 6:55 PM, Taylor Swift via swift-evolution > wrote: > > > > On Thu, Jul 13, 2017 at 6:56 PM, Andrew Trick > wrote: > >> On Jul 12, 2017, at 12:16 PM, Taylor Swift via swift-evolution >> mailto:swift-evolution@swift.org>> wrote: >> >> Hi all, I

Re: [swift-evolution] Pitch: Improved Swift pointers

2017-07-14 Thread Andrew Trick via swift-evolution
> On Jul 14, 2017, at 9:33 AM, Taylor Swift wrote: > > How would you feel about: > > struct UnsafeMutableRawBufferPointer > { > > --- static func allocate(count:Int) -> UnsafeMutableRawBufferPointer > +++ static func allocate(bytes:Int, alignedTo:Int) -> > UnsafeMutableRawBufferPointer >

Re: [swift-evolution] [Review] SE-0182 - String Newline Escaping

2017-07-14 Thread Jordan Rose via swift-evolution
> On Jul 14, 2017, at 10:00, Alex Blewitt wrote: > >> On 13 Jul 2017, at 23:14, David Hart via swift-evolution >> mailto:swift-evolution@swift.org>> wrote: >> >>> >>> On 14 Jul 2017, at 00:21, Jordan Rose >> > wrote: >>> >>> [Proposal: >>> https://github.com/a

[swift-evolution] Pitch: Wrap calls to NSFileHandle and NSData in autorelease pools

2017-07-14 Thread Charles Srstka via swift-evolution
MOTIVATION: Meet Bob. Bob is a developer with mostly C++ and Java experience, but who has been learning Swift. Bob needs to write an app to parse some proprietary binary data format that his company requires. Bob’s written this app, and it’s worked pretty well on Linux: import Foundation do {

Re: [swift-evolution] [Review] SE-0182 - String Newline Escaping

2017-07-14 Thread Alex Blewitt via swift-evolution
> On 13 Jul 2017, at 23:14, David Hart via swift-evolution > wrote: > >> >> On 14 Jul 2017, at 00:21, Jordan Rose > > wrote: >> >> [Proposal: >> https://github.com/apple/swift-evolution/blob/master/proposals/0182-newline-escape-in-strings.md >> >>

Re: [swift-evolution] Pitch: Improved Swift pointers

2017-07-14 Thread Taylor Swift via swift-evolution
How would you feel about: struct UnsafeMutableRawBufferPointer { --- static func allocate(count:Int) -> UnsafeMutableRawBufferPointer +++ static func allocate(bytes:Int, alignedTo:Int) -> UnsafeMutableRawBufferPointer func deallocate() +++ func bindMemory(to:Element.Type, capacity:Int) +++ fu

Re: [swift-evolution] Pitch: Improved Swift pointers

2017-07-14 Thread Taylor Swift via swift-evolution
I’d also like to swap the ordering of `count:` and `to:` in ` UnsafeMutableRawPointer.initializeMemory(as:at:count:to:)` so it matches up with the ordering in `UnsafeMutablePointer.initializeMemory(to:count:) `. On Fri, Jul 14, 2017 at 12:33 PM, Taylor Swift wrote: > How would you feel about: >

Re: [swift-evolution] SE-0181 : should c++ be written "cxx" or "cpp" ?

2017-07-14 Thread Jean-Daniel via swift-evolution
Le 13 juil. 2017 à 00:59, Chris Lattner via swift-evolution a écrit :On Jul 12, 2017, at 2:21 PM, Greg Parker via swift-evolution wrote:On Jul 12, 2017, at 10:21 AM, Trevör ANNE DENISE via swift-evolution wrote:Afte

Re: [swift-evolution] Idea: Use for default implementation of ?

2017-07-14 Thread Jean-Daniel via swift-evolution
If we generate a default• debugDescription for encodable type, I would rather use a human readable formatted string that explicitly do not guarantee to remain stable. JSON is very limited in the types it supports (it does not even supports date natively). A debug description should not

Re: [swift-evolution] Change default compiler fix for not-unwrapped Optional from ! To ?

2017-07-14 Thread Víctor Pimentel via swift-evolution
> On 14 Jul 2017, at 08:05, Rod Brown via swift-evolution > wrote: > > > >> On 14 Jul 2017, at 2:36 pm, Robert Bennett via swift-evolution >> wrote: >> >> When writing Swift code, it is not uncommon to forget to unwrap optionals. >> The compiler will offer a fixit, telling you you must ins