Swift: infer self with '.'

Originator:amber
Number:rdar://20790305 Date Originated:02-May-2015 06:52 AM
Status:Open Resolved:
Product:Developer Tools Product Version:Swift 1.2
Classification:Enhancement Reproducible:Always
 
Summary:
Many times in methods, especially initializers you have a parameter with the same name as a property assignment you would like to make. It would be convenient if you could infer self with just a ‘.’ see example below to see how this would change syntax: 

Example:

func init(instructions: Instructions) {
        self.instructions = instructions
    }

Would become:

func init(instructions: Instructions) {
        .instructions = instructions
    }

Notes:
This is consistent with how enums can infer the enum type

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!