[swift-evolution] Notes from Swift core team 2016-04-20 design discussion
David Waite
david at alkaline-solutions.com
Fri Apr 22 12:04:11 CDT 2016
Sure, but I personally want to configure delegates early, when the delegate is set.
It may be inappropriate to send a synthetic message through (e.g. give me the table row height for arbitrary index -1 so I can detect if you have overridden behavior)
A default implementation may help the caller, but some API do consider a non-default implementation to be a flag in itself.
I don’t think you can meet current objective-c usage and meaning of optional protocols by collapsing the flag into default method behavior. This would cause problems when porting the objective-c caller of the delegate interface to swift.
-DW
> On Apr 22, 2016, at 10:01 AM, Thorsten Seitz <tseitz42 at icloud.com> wrote:
>
> We could require optional methods which would return T to instead return OptionalResult<T> which is essentially an enum with values 'unimplemented' and 'implemented(T)', i.e. essentially the same as Optional but as a separate type to avoid confusion when the real result would be 'T?'.
>
> Default implementations would answer 'unimplemented'.
>
> This would require the caller to handle the unimplemented default case explicitly.
>
> -Thorsten
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160422/ad56ed23/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 496 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160422/ad56ed23/attachment.sig>
More information about the swift-evolution
mailing list