Bug 16371 – warn/deprecate implicit final in interfaces

Status
RESOLVED
Resolution
WONTFIX
Severity
enhancement
Priority
P4
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-08-10T16:24:41Z
Last change time
2023-05-30T15:00:40Z
Keywords
spec
Assigned to
No Owner
Creator
Lodovico Giaretta
See also
https://issues.dlang.org/show_bug.cgi?id=16370

Comments

Comment #0 by lodovico — 2016-08-10T16:24:41Z
Currently templated functions are allowed in interfaces (are them? [1]) and are implicitly marked final. This may be counter-intuitive for new-comers. As final functions in interfaces are not that usual (as interfaces are meant for inheritance), it would ease readibility to oblige the use of explicit final in interfaces. So I propose the deprecation and then removal or implicit final in templated interface functions. [1] https://issues.dlang.org/show_bug.cgi?id=16370
Comment #1 by schveiguy — 2016-08-10T16:40:49Z
I don't think this makes sense. Templates can never add virtual functions or non-static members, even to classes. Why should it be different for interfaces?
Comment #2 by razvan.nitu1305 — 2023-05-30T15:00:40Z
Yes, this does not make sense. Final has no meaning for a templated function irrespective of the declaration site. As Steven pointed out, templates are never virtual.