Skip to content

Instantly share code, notes, and snippets.

@erica
Last active June 30, 2016 23:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save erica/af357a47ec5c1d26028769e1676af799 to your computer and use it in GitHub Desktop.
Save erica/af357a47ec5c1d26028769e1676af799 to your computer and use it in GitHub Desktop.

Updating Buffer "Value" Names to "Header" Names

  • Proposal: TBD
  • Author: Erica Sadun
  • Status: TBD
  • Review manager: TBD

Introduction

This proposal updates parameters and generic type parameters from value names to header names for ManagedBuffer, ManagedProtoBuffer, and ManagedBufferPointer.

All user-facing Swift APIs must go through Swift Evolution. While this is a trivial API change with an existing implementation, this formal proposal provides a paper trail as is normal and usual for this process.

Swift Evolution Thread

Patch

Motivation

This change introduces better semantics for buffer types.

Detailed Design

This update affects ManagedBuffer, ManagedProtoBuffer, and ManagedBufferPointer.

Generic Parameters

The generic parameters <Value, Element> become <Header, Element> in affected classes.

Type Members

Each use of value or Value in type members is renamed to header or Header. Affected members include

  • header: Header
  • _headerPointer, _headerOffset
  • withUnsafeMutablePointerToHeader
  • create(minimumCapacity:makingHeaderWith:) -> Header
  • Initializers that refer to makingHeaderWith

Impact on Existing Code

Existing third party code will need migration using a simple fixit.

Alternatives Considered

Not Applicable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment