> I'm not sure I follow your meaning on omission; I quite like Sean's
> suggestion of having an override(before) or override(final) in the sub-class,
> this way the call is explicitly auto-generated. I think having it be added
> automatically in the regular override case could be a bit confusing, I think
> a warning or error is better in that case as it should be visible so you know
> exactly when it is being called, the other cases don't need it (as they have
> the extra information on the override).
It's always possible to construct examples where there order is important, but
I guess those won't matter in real code — and it would feel very strange to me
if one of the print-statements would cause an error:
override func f(input: Int) {
print("Before")
super.f(input: input)
print("After")
}
(even commands after a return statement compile just fine…)
It is different when the call to super would be inserted automatically:
I don't think that one of the choices is superior, so it should be up to the
author to decide what is preferred.
I'm not sure if it is a good idea to generate calls to super at all — but it
would be similar to willSet/didSet.
- Tino
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution