Please allow me to paraphrase your post, just to make sure I have understood:
If the author of
Base does not intend the
foo method to fulfill a particular requirement, then the author of
Base can not use
conformance indeed, and should not even use
conformance(Foo) (listed in the Future Directions of the pitch).
If, on top of that, the author of
Derived relies on
Base.foo for its
Foo conformance, then one can wonder indeed where this intent could be materialized.
And you suggest an extra
conformance func foo() without any body in
Did I get this right? If yes, I'll at least extend the "Know Limits" section of the pitch.
- This would break backward compatibility.
Indeed. Not the end of the world but definitely increases the stakes.
The pitch, as written, does not want to break backward compatibility.
When you upgrade a library, and the library adds a requirement that happens to match one of your declarations, you end up with a fortuitous fulfillment which was not intended. If the language would force you to add
conformance to this declaration, then:
- You no longer declare an intent with
conformance, but you obey the compiler.
- The library has shipped a breaking change, since you're forced to modify your code.
I'd say "a minor inconvenience in some cases, totally fine in others". Note that we have a precedent already: you are adding an extension with a block of related methods to add a feature but you have to add that feature variables into the main type body as you can't add those to an extension.
I beg to disagree, and this is not a relevant precedent. Adding a stored property inside an extension is never possible. With the
conformance extension construct, the related apis are sometimes allowed (plain
extension), and sometimes forbidden (
conformance extension). The mere addition of
conformance in front of
extension may force you to find a new home for some methods. What is an "inconvenience" for you is a daunting error for other people.
The quest for designs that are as free as possible from caveats is hard, but I think it's worth it. The problems of the
conformance extension construct are identified, and they are not necessary for the pitch to be useful. They did not make the cut.