[swift-users] Why will RawByte be deprecated in Swift 3?

Marco Masser lists at duckcode.com
Mon Feb 15 06:00:56 CST 2016

> On 2016-02-13, at 05:38, Dmitri Gribenko <gribozavr at gmail.com> wrote:
> On Fri, Feb 12, 2016 at 2:34 AM, Marco Masser via swift-users
> <swift-users at swift.org> wrote:
>> There’s a RawByte struct in the Swift 2.2 standard library:
>> /// A byte-sized thing that isn't designed to interoperate with
>> /// any other types; it makes a decent parameter to
>> /// `UnsafeMutablePointer<Memory>` when you just want to do bytewise
>> /// pointer arithmetic.
>> @available(*, deprecated, message="it will be removed in Swift 3")
>> public struct RawByte {
>> }
>> Why is that deprecated? On the current Swift master branch (22c4d7d) it’s
>> still used in the String-related code and there’s also no mention about it
>> being deprecated. Is there a replacement for RawByte? Should I just write my
>> own version when I don’t want Int8 or UInt8 to mean “just a byte”?
> Using UInt8 or Int8 is recommended.

OK, I settled on typealias Byte = UInt8 within my Socket type, so it’s Socket.Byte now.

>> Bonus question: Where does this deprecation come from? How can something be
>> deprecated in the public Swift release when it’s not deprecated in the Swift
>> source?
> It comes from a preview implementation of SE-0006
> https://github.com/apple/swift-evolution/blob/master/proposals/0006-apply-api-guidelines-to-the-standard-library.md

Ah, missed that one in the diffs. Thanks for pointing it out.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20160215/891d3949/attachment.html>

More information about the swift-users mailing list