To expand on 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


@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

Follow friends and discover new ones. Publish anything you want: links, pictures, text, video. This server is run by the main developers of the Mastodon project. Everyone is welcome as long as you follow our code of conduct!