It seems to me that such a linter would need to scan the entire module to determine if a class is subclassed, provided that it is internal. My understanding of linters is that they typically don't do static analysis of this sort, they are more targeted at local source or AST analysis. Whole module optimization already looks at if an internal class is subclassed in order to do its work, so presumably the same sort of analysis would be required which suggests a compiler feature as I understand it.
On 6/16/2016 4:32 PM, Saagar Jha via swift-evolution wrote: > I think that linters are the best way to handle this. It’s not really > a code smell that should always be taken care of (which would indicate > that the compiler should warn about it), and as such should be > relegated to the linter. > > On Thu, Jun 16, 2016 at 10:08 AM Rehat Kathuria via swift-evolution > <[email protected] <mailto:[email protected]>> wrote: > > Agree with Sean that this shouldn’t apply to classes declared > public; I also don’t think the "default by final” discussion ever > came to a consensus. > > As for linters, my understanding of them is that they’re inclined > to style-guides as opposed to architectural suggestions.The > declaration of a class being final isn’t one that’s dependant on > style, rather architecture. > > >> On 16 Jun 2016, at 17:57, Xiaodi Wu <[email protected] >> <mailto:[email protected]>> wrote: >> >> On Thu, Jun 16, 2016 at 11:39 AM, L. Mihalkovic via >> swift-evolution <[email protected] >> <mailto:[email protected]>> wrote: >> >> Likely a lint level feature, no? >> >> >> Agreed. Sounds like a linter feature. >> >> >> > On Jun 16, 2016, at 6:27 PM, Sean Heber via swift-evolution >> <[email protected] >> <mailto:[email protected]>> wrote: >> > >> > I would think this would not apply to public classes. >> > >> > There has also been discussion in the past about making >> final the default - I don’t remember if that ever resolved >> into some kind of consensus or not, though. >> > >> > l8r >> > Sean >> > >> > >> >> On Jun 16, 2016, at 11:23 AM, Saagar Jha via >> swift-evolution <[email protected] >> <mailto:[email protected]>> wrote: >> >> >> >> Correct me if I’m wrong, but if you’re writing some kind >> of framework and your class is not final but never >> subclassed, you wouldn’t want the warning, even if you’d like >> to allow users to subclass it? >> >> >> >> >> >> >> >> On Thu, Jun 16, 2016 at 9:02 AM Rehat Kathuria via >> swift-evolution <[email protected] >> <mailto:[email protected]>> wrote: >> >> 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] <mailto:[email protected]> >> >> https://lists.swift.org/mailman/listinfo/swift-evolution >> >> -- >> >> -Saagar Jha >> >> _______________________________________________ >> >> swift-evolution mailing list >> >> [email protected] <mailto:[email protected]> >> >> https://lists.swift.org/mailman/listinfo/swift-evolution >> > >> > _______________________________________________ >> > swift-evolution mailing list >> > [email protected] <mailto:[email protected]> >> > https://lists.swift.org/mailman/listinfo/swift-evolution >> _______________________________________________ >> swift-evolution mailing list >> [email protected] <mailto:[email protected]> >> https://lists.swift.org/mailman/listinfo/swift-evolution >> >> > > _______________________________________________ > swift-evolution mailing list > [email protected] <mailto:[email protected]> > https://lists.swift.org/mailman/listinfo/swift-evolution > > -- > -Saagar Jha > > > _______________________________________________ > 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
