Follow

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

@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
Hostux.social

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!