Review of "review capture semantics of self"

with SR-10218 implemented i still see a warning in the form Call to method xxx in closure requires explicit use of 'self' to make capture semantics explicit. with the subsequent two fixit choices (self.xxx or [self] in). shall we change the warning to suggest Capture 'self' explicitly to enable implicit 'self' in this closure instead? probably along with the removal of "self." fixit option? possibly along with further deprecation of explicit "self." to denote self capturing and a warning + fixit to that account to push users towards explicit self capturing in the capture list?

Yeah, IIRC there's a note at the end of SE-0269 to that effect. Having done an extensive amount of work in a codebase with a style guide that requires explicit self everywhere, I would love if we could start enforcing (in a new language mode) the capture list as the blessed way to make a capture explicit, since the existing rules don't protect against accidental captures at all unless you always use implicit self by default.

Terms of Service

Privacy Policy

Cookie Policy