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 < [email protected]> 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 <[email protected]> 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 > [email protected] > https://lists.swift.org/mailman/listinfo/swift-evolution >
_______________________________________________ swift-evolution mailing list [email protected] https://lists.swift.org/mailman/listinfo/swift-evolution
