[swift-evolution] [Proposal] Allow upgrading weak self to strong self by assignment
Andrew Bennett
cacoyi at gmail.com
Sat Feb 20 02:55:03 CST 2016
Yes, I only learnt about it from Chris Lattner's comment. Great idea to do
it right :)
If I remember correctly I think he said not to rely on it because it wasn't
intentional. I'm not sure if he said it was undesirable. I thought it may
be worth mentioning in case you didn't know, and because it may help the
proposal if it had:
- you can already do `self` = self, but it's not officially supported
- this formalises that ability, and removes the need for backticks
Also, you may want to mention that this **only** works between `self`
and `[weak
self]`, ie. you cannot do:
guard self = Optional.Some(123) else { ... }
On Sat, Feb 20, 2016 at 1:18 PM, Evan Maloney <emaloney at gilt.com> wrote:
> > On Feb 19, 2016, at 8:40 PM, Andrew Bennett via swift-evolution <
> swift-evolution at swift.org> wrote:
> >
> > A quick note, I'm not sure if it's a hack but you can probably still do
> this:
> >
> > guard let `self` = self else { return }
>
> IIRC, the fact that this works is accidental and Chris Lattner mentioned
> that it should be considered a bug.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160220/e425da04/attachment.html>
More information about the swift-evolution
mailing list