[swift-evolution] [swift-evolution-announce] [Review] SE-0044 Import as Member

Douglas Gregor dgregor at apple.com
Wed Mar 23 12:27:00 CDT 2016


> On Mar 22, 2016, at 9:30 PM, Brent Royal-Gordon <brent at architechies.com> wrote:
> 
>> float Point3DGetPointAtIndex(int idx, Point3D point)
>> __attribute__((swift_name("getter:subscript(_:self:)")))
>> void Point3DSetPointAtIndex(int idx, Point3D point, float val)
>> __attribute__((swift_name("getter:subscript(_:self:newValue:)")))
> 
> I think this is the best option. Subscripts can have multiple parameters, including parameter labels, so you need the full range of expressiveness, including `_`, to correctly represent them. `newValue`'s name is technically changeable, but it almost never actually *is* changed, and everyone will understand what it refers to.


Right. And at worse we’ve eliminated the ability to express

subscript (newValue newValue: Int) -> Int { … }

I can live with that limitation.

	- Doug

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160323/296fb774/attachment.html>


More information about the swift-evolution mailing list