[swift-evolution] What about a VBA style with Statement?

Vladimir.S svabox at gmail.com
Wed Apr 13 11:54:36 CDT 2016


On 13.04.2016 18:09, Radosław Pietruszewski wrote:
> I’m -1, at least in the foreseeable future. I do agree that this is a
> useful construct, but if I can do it in library code, paying only a small
> price for this, I’d prefer Swift to grow better in places that a library
> *can’t* fix.

Well, there a lot of things that *your personal* library can fix for you.
Should we stop improve the language and start to write just personal libs 
with improvements?
This proposals about the feature that makes Swift better, more enjoyable to 
work with.

Btw, this "with" method you suggest is not replacement for language 
construction - it allows compilation when struct instance constant (let s = 
SomeStruct()) is changed inside block. Do you like this? Do you want to 
produce such an non-safe code to your projects?

>
> No — for now, it’s best to use a free function for now. And, like I

No, not best, even not OK. Described above.

> mentioned, universal conformances could allow this to be easily added to
> all types — and so I’d focus on pushing *that* proposal.

As I understand, such a method will have the same problem with un-safe 
behavior in case of constant.


More information about the swift-evolution mailing list