[swift-evolution] Final by default for classes and methods

Tino Heth 2th at gmx.de
Tue Dec 22 08:26:02 CST 2015

>> Btw: I wouldn't oppose a proposal to allow changing conventions like this (there are at least two other discussions about the best default) on a per module/file basis — as long as the "local" effect of the setting isn't vital, there shouldn't be a problem with customizing.
> I would really be opposed to this.  It would not be clear when reading code what it actually means.  Copy and paste would also be problematic for similar reasons.  Flags should not change the semantics of a piece of code.
That's what I meant with "local effect":
For an algorithm, it doesn't matter wether it's implemented in a final or non-final method, or if it produces warnings that don't happen with different compiler flags; and even if you copy whole files from other people with a different opinion on sane defaults, the worst thing to happen in the case of final is an error when you try to override something that is not explicitly marked as non-final.
Imho that's nothing compared to the hoops we had to jump through when ARC was introduced — and the alternatives are either arguing forever or deciding to annoy a part of the community.
Additionally, as soon as you change the default behavior, the same problems arise…

Best regards,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151222/1f41c864/attachment.html>

More information about the swift-evolution mailing list