To expand on hostux.social/@cocoasamurai/10 I think the solution is quite simple. Annotate a func in a protocol with an `optional` keyword. If you've not provided a default implementation in a protocol extension the compiler should produce an error saying a default implementation is needed because the method has been annotated with the optional keyword. The intent is made clear in the declaration, and only required func stubs are provided by the compiler

Follow

@cocoasamurai I think this is a quite clever solution that doesn’t inject the ? problem I was objecting to.

@cocoaphony yeah, I think I'll write up something about this and see what feedback I get from others. It feels like this would just be the compiler enforcing an already existing practice and allowing an annotion onto func declarations in protocols to better express intent

Sign in to participate in the conversation
Mastodon

Server run by the main developers of the project 🐘 It is not focused on any particular niche interest - everyone is welcome as long as you follow our code of conduct!