Further, any news regarding the package-protected ...
# language-proposals
g
r
Hah! Sorry, my comment wasn't a counter to yours, just a funny coincidence.
g
XD nevermind
k
Can you elaborate a bit on the weak reference? Who has a weak reference to what?
g
E.g. when you pass a lambda instead of a SAM interface to a function, this newly created anonymous object will hold a strong reference to the encapsulating class. When using Swift, it is possible to explicitly specify
[weak self]
in the list of arguments the lambda (or closure, as its called in swift) captures, which causes the reference to the encapsulating object to be a weak one.
k
Ah you want a reference to the lambda itself?
g
No, I don't. I want the reference a lambda usually captures to the enclosing class to be a weak one.
Copy code
someFunctionThatTakesAClosure { [weak self] in print($0) }
Taken from the last section of this (https://stackoverflow.com/a/42275638/4929939) stackoverflow answer.
g
This is wrong slack channel to ask about feature status