[swift-evolution] [Pitch] Circling back to `with`
Erica Sadun
erica at ericasadun.com
Wed May 25 15:56:54 CDT 2016
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 <mailto: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.
-- E
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160525/6b5c029d/attachment.html>
More information about the swift-evolution
mailing list