# Review #2 of SE-0237: Introduce withUnsafe Mutable BufferPointerIfSupported methods

**URL:** <https://forums.swift.org/t/review-2-of-se-0237-introduce-withunsafe-mutable-bufferpointerifsupported-methods/18418>\
**Category:** Proposal Reviews\
**Created:** [November 30, 2018, 12:59am UTC](https://forums.swift.org/t/review-2-of-se-0237-introduce-withunsafe-mutable-bufferpointerifsupported-methods/18418 "2018-11-30T00:59:22Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Douglas\_Gregor](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/douglas_gregor/32/1362_2.png) [@Douglas\_Gregor](https://forums.swift.org/u/Douglas_Gregor)\
**Post date:** [November 30, 2018, 12:59am UTC](https://forums.swift.org/t/review-2-of-se-0237-introduce-withunsafe-mutable-bufferpointerifsupported-methods/18418/1 "2018-11-30T00:59:22Z")

</div>

Hello Swift Community,

Based on [feedback from the Core Team](https://forums.swift.org/t/review-of-se-0237-introduce-contiguous-collection-protocols/18069/8) and the first review, SE-0237 has been revised. We will have a second review of the revised [SE-0237 "Introduce `withUnsafe{Mutable}BufferPointerIfSupported` methods"](https://github.com/apple/swift-evolution/blob/master/proposals/0237-contiguous-collection.md) that starts now and goes through **December 3, 2018**.

Reviews are an important part of the Swift evolution process. All review feedback should be either on this forum thread or, if you would like to keep your feedback private, directly to the review manager (via direct message in the Swift forums).

## What goes into a review of a proposal?

The goal of the review process is to improve the proposal under review through constructive criticism and, eventually, determine the direction of Swift.

When reviewing a proposal, here are some questions to consider:

- What is your evaluation of the proposal?
- Is the problem being addressed significant enough to warrant a change to Swift?
- Does this proposal fit well with the feel and direction of Swift?
- If you have used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?
- How much effort did you put into your review? A glance, a quick reading, or an in-depth study?

Thanks!  
Doug Gregor  
Review Manager

---

<div class="post-metadata">

**Author:** ![jrose](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/jrose/32/408_2.png) [@jrose](https://forums.swift.org/u/jrose)\
**Post date:** [November 30, 2018, 1:02am UTC](https://forums.swift.org/t/review-2-of-se-0237-introduce-withunsafe-mutable-bufferpointerifsupported-methods/18418/2 "2018-11-30T01:02:56Z")

</div>

Looks like there's a stray "with a default implementation when the collection conforms to `MutableContiguousCollection`" which should just be dropped. (And a handful of references to the old names without "IfAvailable".)

---

<div class="post-metadata">

**Author:** ![Nobody1707](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/nobody1707/32/2169_2.png) [@Nobody1707](https://forums.swift.org/u/Nobody1707)\
**Post date:** [November 30, 2018, 6:50am UTC](https://forums.swift.org/t/review-2-of-se-0237-introduce-withunsafe-mutable-bufferpointerifsupported-methods/18418/3 "2018-11-30T06:50:27Z")

</div>

I believe this is also left over from the previous version of the proposal:

> The choice to refine `RandomAccessCollection` is based on the assumption that there are no reasonable contiguous collections that wouldn't also be random-access.

---

<div class="post-metadata">

**Author:** ![lukasa](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/lukasa/32/1232_2.png) [@lukasa](https://forums.swift.org/u/lukasa)\
**Post date:** [November 30, 2018, 10:54am UTC](https://forums.swift.org/t/review-2-of-se-0237-introduce-withunsafe-mutable-bufferpointerifsupported-methods/18418/4 "2018-11-30T10:54:35Z")

</div>

> [@Douglas\_Gregor](#):
>
> - What is your evaluation of the proposal?

+1. Some notes:

- There's a typo in the first paragraph, which reads "These methods will allow generic code on to make use of the thos respective"; "thos" should be "those".
- The first sentence is weirdly ungrammatical: "This proposal introduces two new methods, on `Sequence` , on `MutableCollection`". That may want to be revised.

Otherwise I think this is good.

> [@Douglas\_Gregor](#):
>
> - Is the problem being addressed significant enough to warrant a change to Swift?

Yes. Particularly when writing high performance networking code, which spends a lot of time shuttling bytes around, it is helpful to be able to expose the bytes in a wide range of different types without paying too much cost for indirection. This proposal makes doing this kind of thing much easier.

> [@Douglas\_Gregor](#):
>
> - Does this proposal fit well with the feel and direction of Swift?

Yes.

> [@Douglas\_Gregor](#):
>
> - How much effort did you put into your review? A glance, a quick reading, or an in-depth study?

A read of this proposal and the related proposal for contiguous collections.

---

<div class="post-metadata">

**Author:** ![johannesweiss](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/johannesweiss/32/38183_2.png) [@johannesweiss](https://forums.swift.org/u/johannesweiss)\
**Post date:** [November 30, 2018, 11:38am UTC](https://forums.swift.org/t/review-2-of-se-0237-introduce-withunsafe-mutable-bufferpointerifsupported-methods/18418/5 "2018-11-30T11:38:49Z")

</div>

> [@Douglas\_Gregor](#):
>
> - What is your evaluation of the proposal?

Yes, please! This would allow SwiftNIO to have much better implementations of writing various standard data-types to `ByteBuffer`s and will generally allow things to avoid extra copies where they're really unnecessary.

> [@Douglas\_Gregor](#):
>
> - Is the problem being addressed significant enough to warrant a change to Swift?

Yes, minimal change to Swift for great benefit.

> [@Douglas\_Gregor](#):
>
> - Does this proposal fit well with the feel and direction of Swift?

Yes!

> [@Douglas\_Gregor](#):
>
> - How much effort did you put into your review? A glance, a quick reading, or an in-depth study?

Read the proposal and struggled without having it before 🙂

---

<div class="post-metadata">

**Author:** ![ben-cohen](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/ben-cohen/32/296_2.png) [@ben-cohen](https://forums.swift.org/u/ben-cohen)\
**Post date:** [November 30, 2018, 2:18pm UTC](https://forums.swift.org/t/review-2-of-se-0237-introduce-withunsafe-mutable-bufferpointerifsupported-methods/18418/6 "2018-11-30T14:18:53Z")

</div>

Sorry about the leftovers of the protocol in the updated version. Should be fixed now on master. Diff [here](https://github.com/apple/swift-evolution/commit/9d47059ad2a293b5db9911e4249dbb07e33a7a74).
