the.bay.news

[Pitch] Ownership for Subscript Parameters

Swift Forums
[Pitch] Ownership for Subscript Parameters
Hi all, Here is a short "filling in gaps" pitch to enable inout, borrowing, and consuming parameters for subscripts. This will make the following ill-formed code valid: struct X { subscript(oldValue: inout Int) -> Int { get { // ... } set { oldValue = newValue // set newValue } } } struct Y { subscript(resourceHandle: borrowing Resource) -> Data { get { ... } set { ... } } } struct Z { subscript(resourceHandle: consuming Resource) -> S...

0 comments

Sign in to join the discussion — your thebay.events account works here.

No comments yet.