[swift-evolution] [Proposal draft] Remove objc requirement for optional protocol methods/properties

Douglas Gregor dgregor at apple.com
Mon Jan 11 14:39:41 CST 2016

> On Jan 11, 2016, at 12:24 PM, David Scrève <david.screve at dlta-studio.com> wrote:
>> Le 11 janv. 2016 à 18:20, Douglas Gregor <dgregor at apple.com <mailto:dgregor at apple.com>> a écrit :
>>>     var loadPerson:(() -> Person)? {
>>>         return { return Person(name: "Scrève", surname: "David")}
>>>     }
>>> }
>>> 	Double returns is quite complex to write and understand..but I agree this problem can be solved like this.
>> Right. One could extend the language with a rule that allows a method to satisfy a read-only property requirement when that property is of (possibly optional) function type.
> 	Yes, this could be a really good solution…Should I post a proposal for that ?

If you want to tackle the larger proposal of “remove optional requirements” and the various pieces required to make that happen, sure. One issue I haven’t thought about much is how to deal with the argument labels when performing this transformation, because we cannot overload properties. For example, importing UITableViewDataSource would end up with several dozen things named “tableview” :)

	- Doug

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160111/84d766b8/attachment.html>

More information about the swift-evolution mailing list