Use "default" keyword for default visibility.
Adrian Kuhn
akuhn at iam.unibe.ch
Sun Mar 1 01:01:44 PST 2009
PROJECT COIN SMALL LANGUAGE CHANGE PROPOSAL FORM v1.0
AUTHOR(S): Adrian Kuhn
OVERVIEW
Allow the "default" keyword to be used as modifier for default
visibility. In strict mode, missing use of default is a warning /
error, in compatibility mode both the current (ie no default keyword)
and the new syntax are accepted.
FEATURE SUMMARY: Use "default" keyword for default visibility.
MAJOR ADVANTAGE: The missing keyword for default visibility breaks the
symmetry of visibility modifiers. Since it is the only implicit
modifier, omitting any of the three explicit modifiers by mistake may
be the source of unexpected behavior and thus hard to track down bugs.
(There was an example on a blog post recently, but I cannot find it
know).
MAJOR BENEFIT: Symmetry of visibility modifiers is restored.
MAJOR DISADVANTAGE: Two ways to express the same thing (in
compatibility mode).
ALTERNATIVES: Using a comment such as /* default */ is not an
alternative since such comments are not processed by the compiler.
EXAMPLES
public class C {
default Field f;
}
SIMPLE EXAMPLE: See above.
ADVANCED EXAMPLE: None.
DETAILS
SPECIFICATION: "default" is already a keyword and introducing it as a
new visibility modifier is save, it does not lead to ambiguous grammar.
COMPILATION: Same as now for implicit default visibility.
TESTING: Same as now for implicit default visibility.
LIBRARY SUPPORT: None.
REFLECTIVE APIS: None.
OTHER CHANGES: None.
MIGRATION: Compatibility mode allows both, implicit and explicit
default visibility, to be used at the same time.
COMPATIBILITY
BREAKING CHANGES: None.
EXISTING PROGRAMS: Work fine in compatibility mode.
REFERENCES
EXISTING BUGS: To my best knowledge, none.
URL FOR PROTOTYPE (optional):
More information about the coin-dev
mailing list