[Proposal] Struct syntax for requesting a copy with an ivar set to an explicit value


(Grant Sheldon) #1

Hi all,

I am hoping to get some feedback on a new proposal:

https://gist.github.com/gsheld/542a57c1ca5efe87892a28759215283e

The basic idea is to expose syntax that would make it trivial to create a
copy of a Struct instance with an ivar set to a particular value. The
"proposal" I've linked above will give examples and some motivation for the
suggestion. It is a simple gist and not in any way ready for a PR.

Let me know what you think! I'm curious to know if this bit of syntactic
sugar would have value for any of you.

Best wishes,

···

--
Grant Sheldon


#2

As an additive proposal this is out of scope for Swift 3. Discussion of
additive proposals resumes August 1.

This functionality has been discussed on-list before, especially regarding
a global “with” function. I believe Erica Sadun has a particularly elegant
implementation.

Nevin

···

On Thu, Jul 21, 2016 at 7:08 PM, Grant Sheldon via swift-evolution < swift-evolution@swift.org> wrote:

Hi all,

I am hoping to get some feedback on a new proposal:

https://gist.github.com/gsheld/542a57c1ca5efe87892a28759215283e

The basic idea is to expose syntax that would make it trivial to create a
copy of a Struct instance with an ivar set to a particular value. The
"proposal" I've linked above will give examples and some motivation for the
suggestion. It is a simple gist and not in any way ready for a PR.

Let me know what you think! I'm curious to know if this bit of syntactic
sugar would have value for any of you.

Best wishes,

--
Grant Sheldon

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