[swift-evolution] [Discussion] Enforcing Calling Super

Tino Heth 2th at gmx.de
Tue Mar 1 06:51:15 CST 2016


I'm quite late at this party, but I always thought that it is a pity that NS_REQUIRES_SUPER hasn't been utilized more in Cocoa (all those view-controller methods…), and that it would be a valuable addition to Swift.
In the final-by-default discussion, I even proposed to make this behavior the default, and there haven't been any real arguments why final would be the better choice.

But I think the naming is really poor...
To express the meaning, it should be "superNeedsToBeCalledOnOverride" — that is, of course, a terrible name for an attribute, but "requiresSuper" is just wrong:
You declare something and say "this requires super", but then ignore that requirement, because in the implementation, there is no "super" (at this point, it's actually self instead of super… I'm not that happy with my explanation, but I hope you understand it anyways).

Maybe a native speaker could come up with better words, but so far, I like "compulsive" the most ("mandatory" would be possible as well… and maybe there is a special word for inheritance of duties).

Tino


More information about the swift-evolution mailing list