I think unextended classes shouldn't be a compiler warning. They even shouldn't be an optional linter warning.
There is a class. It doesn't have subclasses because I may have not written them yet. The process of writing software has to be anticipated somehow. I have 2 options: 1) I write the superclass first. Didn't declare it as final. Now I have to live with the warning until I first subclass it. This is really bad, because it encourages the habit of ignoring warnings. 2) I write the superclass first and mark it final. Later I write a subclass and remove the 'final' keyword again. => This makes people mark classes as final just because they aren't yet subclassed. This is really bad, and it sends the wrong signals to fellow developers. Marking a class as final signals that the class shouldn't be subclassed; whereas under this proposal developers are encouraged to mark classes as final just because they are not yet subclassed. Have you considered code evolution? Furthermore, having a non-final class that is not subclassed, is not a bug. Declaring a variable and then never using it, is in many cases a bug. Most warnings hint at a likely bug, this warning doesn't. -Michael > Am 16.06.2016 um 11:55 schrieb Rehat Kathuria via swift-evolution > <[email protected]>: > > I’d like the compiler to present a warning when a class not declared as final > is never subclassed. Thoughts? > _______________________________________________ > swift-evolution mailing list > [email protected] > https://lists.swift.org/mailman/listinfo/swift-evolution _______________________________________________ swift-evolution mailing list [email protected] https://lists.swift.org/mailman/listinfo/swift-evolution
