[swift-evolution] Assigning to 'self' in protocol extensions
fs.output at gmail.com
Fri Jan 20 03:05:53 CST 2017
> In the specific case of initializers, my opinion here is the opposite in
>> fact — I think assigning to ‘self’ should be permitted in all convenience
>> initializers, even initializers defined directly classes, without the
>> protocol extension trick. Also, we should lower this more efficiently than
>> we do today, without creating a self ‘carcass’ that is allocated and
>> immediately freed, to be replaced by the ‘real’ self.
> I totally agree. And I think that is the least impact way on the language
Oops, It seems I have to take back my words.
With my "factory initializer" example:
let dog = Dog(type: "cat")
type(of: dog) == Cat.self
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution