[swift-evolution] Notes from Swift core team 2016-04-20 design discussion

Shawn Erickson shawnce at gmail.com
Fri Apr 22 15:31:02 CDT 2016

I have the same thoughts and also have code that configures itself on
delegate setting.

On Fri, Apr 22, 2016 at 10:04 AM David Waite via swift-evolution <
swift-evolution at swift.org> wrote:

> 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
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160422/3249ba27/attachment.html>

More information about the swift-evolution mailing list