[sealed] Use 'open' instead of 'non-sealed'?
amaembo at gmail.com
Tue Jan 26 09:36:18 UTC 2021
The 'non-sealed' keyword looks not very java-ish. It adds cognitive
load, especially to non-native speakers, as it includes the negation
inside. Also, it complicates tooling implementation (in particular,
lexing Java programs). Probably some of us want to move forward the
hyphenated keywords proposal and need a guinea pig to experiment with,
but this doesn't seem enough reason to justify its use.
I suggest using the 'open' contextual keyword instead. The 'open'
class/interface means that it can be inherited without any
restriction. 'open', 'sealed', and 'final' keywords are mutually
exclusive. Any class/interface is either 'open', or 'sealed', or
'final', no other option. The classes that don't directly
extend/implement sealed classes/interfaces are implicitly 'open'
(though it's possible to redundantly specify the 'open' keyword). The
classes that extend/implement sealed class/interface must specify
What do you think?
With best regards,
More information about the amber-spec-experts