[swift-users] Convenience initializers in structs?

Jordan Rose jordan_rose at apple.com
Tue Jul 18 18:17:35 CDT 2017



> On Jul 18, 2017, at 15:56, Slava Pestov via swift-users <swift-users at swift.org> wrote:
> 
> 
>> On Jul 18, 2017, at 3:54 PM, Chris McIntyre <nothingwasdelivered at gmail.com <mailto:nothingwasdelivered at gmail.com>> wrote:
>> 
>> Was it ever explained why the syntax is different?
>> 
> 
> Oh. I think convenience initializers on classes are marked as such explicitly because convenience vs designated has an effect on the ABI of an initializer, for the purposes of inheritance. With a value type, it doesn’t change anything about how the initializer is used externally.
> 
> Yeah, probably the AST printer should not print the ‘convenience’ keyword on non-class initializers.

FWIW I tried to stop doing this in the actual AST representation and it caused problems (https://github.com/apple/swift/pull/8540/commits/4f6e88b009ad07edd35343c2c9b758f03029a731 <https://github.com/apple/swift/pull/8540>). That's probably the right way for us to go for real, though, not just hiding the kind in the printer.

Jordan

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20170718/7cae2f72/attachment.html>


More information about the swift-users mailing list