[swift-evolution] [Pitch] Circling back to `with`
matthew at anandabits.com
Wed May 25 16:29:14 CDT 2016
Sent from my iPad
> On May 25, 2016, at 3:56 PM, Erica Sadun <erica at ericasadun.com> wrote:
>> On May 25, 2016, at 2:55 PM, Matthew Johnson <matthew at anandabits.com> wrote:
>>> On May 25, 2016, at 3:48 PM, Jacob Bandes-Storch via swift-evolution <swift-evolution at swift.org> wrote:
>>> I like this pretty well, and I think "with()" makes sense as a peer of "withUnsafePointer()", "withExtendedLifetime()", etc.
>>> I'd also be okay with waiting for a comprehensive method-cascading solution. I don't find this issue particularly urgent, because it's pretty easily solvable with an extension or just using closures.
>> +1. I’ve been playing around with it in my own code a little bit. I’m still uncertain about when I think it is good style and when I think it is best avoided. I would certainly feel more comfortable using it if it was in the standard library.
>> At the same time, I think we can and should do better in the future. If that is the plan, do we really want `with` in the standard library? I don’t mind waiting for a better solution, especially if it means a better solution is more likely to happen and / or we aren’t left with an unnecessary and duplicative function in the standard library.
>> So I’m on the fence here.
> I wouldn't be pushing if I thought it wouldn't be useful after cascading. If no other reason, it offers a way to duplicate/modify value types to be stored into constants. That alone should argue for its value.
Can you point us to the latest draft of what you have in mind for cascading in the future?
> -- E
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution