[swift-evolution] Proposal: Add @requires_super attribute
javier.api at gmail.com
Wed Dec 16 20:22:13 CST 2015
I'm not a fan of this feature because it encourages a type of API design
that's really hard to ensure that it's used correctly. The biggest problem
is the fact that often when a class expects or allows a method to be
overriden, and super needs to be called, it expects the call to happen in a
particular order: either before of after the implementation from the
So yes, this is missing from Obj-C, yes, this is important because UIKit,
but going forward my feeling is that a language without this feature is a
language that will force you to think about an alternative way to implement
an API without this, and that'll probably be less error-prone.
On Wed, Dec 16, 2015 at 3:03 PM Tino Heth via swift-evolution <
swift-evolution at swift.org> wrote:
> Default behavior would require something like "unrequire" which seems odd.
> the keyword for requires_super is so odd, it doesn't even fit in a single
> word! ;-)
> I think it is much easer to find a word for something that can be replaced
> completely than for "you have to call the implementation of the parent
> Also this would break a lot of existing code and migration can't be done
> Two parts:
> What is a lot? I really don't think calling super hurts in many places.
> Why shouldn't it be possible to migrate automatically? It might get
> complicated for compiled libs, but definitely possible.
> swift-evolution mailing list
> swift-evolution at swift.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution