Proposal: Improved Wildcard Syntax for Java
Reinier Zwitserloot
reinier at zwitserloot.com
Sat Feb 28 23:08:41 PST 2009
This proposal is lacking in the 'disadvantages' section, in two ways.
The listed disadvantage is unfairly sugared over; because the 'out/in'
terminology does not allow you to bind the generics parameter, the
'extends'/'super' syntax will never become outdated and the need to
remember that 'out' is analogous to 'extends' and 'in' is analogous to
'super' does not go away.
There's another disadvantage that isn't listed at all: Neither 'in'
nor 'out' are keywords in java currently. Therefore, you introduce the
notion of a context-sensitive keyword, but as far as I understand it,
java does not currently have context-sensitive keywords. Adding them
is a big can of worms that should probably warrant some discussion (in
the sense that it may complicate java parsers, and how the idea of
context-sensitive keywords makes it a lot harder for any parser to use
a keyword as an anchor point); at any rate it is a disadvantage that
should be listed.
There's also a typo in 'mneumonic' :)
NB: For what it's worth, because the need to remember super-produces
extends-consumes does not go away, I don't think this is going to help
much. Perhaps make 'out' and 'in' valid context-sensitive keywords
that can be used as a substitution for super and extends, and add that
a missing generics variable on the LHS implies a wildcard?
--Reinier Zwitserloot
More information about the coin-dev
mailing list