Ah, yes, you are right, I didn’t think of configuring delegates when the delegate ist set.
-Thorsten > Am 22.04.2016 um 19:04 schrieb David Waite <[email protected]>: > > 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] >> <mailto:[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
