On September 2, 2016 at 2:36:43 AM, Andrew Trick (atr...@apple.com) wrote:

After thinking about this for a moment, I like the approach of extending 
UnsafeBytes with release-mode bounds checked versions of subscript, load, and 
storeBytes.
I agree with this, I think it's mostly a question of naming and defaults.  My 
concern here is letting a swift developer accidentally write heartbleed, which 
we can't actually prevent, but we can make it harder.

IMO 

1.  There should be clear consistency in the checked-ness of the API surface.  
Agree that checked iterator makes no sense, but I think the most important 
thing is to avoid creating a job interview trivia game where `set` is checked 
but `store` is unchecked, spot the bug in this function.

2.  For consistency with UnsafeBufferPointer it may make the most sense to just 
ship unchecked or ship an opt-in checked wrapper.  I believe however that the 
existing precedent is all wrong on this point, and I'd like to see us revisit 
this question across both interfaces in Swift 4, but I don't want to lay out a 
whole case here that should be its own thread.

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to