Proposal: Type inference for variable definition/initialization using the 'auto' keyword.
reinier at zwitserloot.com
Tue Apr 7 13:45:26 PDT 2009
The parser cannot distinguish between the two, so the only solution
would be to amend the semantic translation of parser tokens as such:
Any method declaration that is abstract but lacks the abstract or
native modifier is actually a field declaration with an auto-
I'm extremely prejudiced against such hackery at the parser level.
What if later we want to give the 'abstract' keyword meaning when it
is used on fields? All existing tools would also have to do some
potentially serious rewriting and refactoring in order to accomodate
such a change.
Like it? Tip it!
On Apr 7, 2009, at 21:00, alexandre.makarenko at free.fr wrote:
> method ?
> it lacks the method body (or abstract or native modifier)
> ----- Original Message -----
> From: "Reinier Zwitserloot" <reinier at zwitserloot.com>
> To: coin-dev at openjdk.java.net
> Sent: Tuesday, April 7, 2009 2:37:18 AM GMT +01:00 Amsterdam /
> Berlin / Bern / Rome / Stockholm / Vienna
> Subject: Re: Proposal: Type inference for variable definition/
> initialization using the 'auto' keyword.
>> Map<String, List<String>> anagrams();
> Actually looks like a method declaration (in fact, it is
> indistinguishable from it!), so the syntax needs work.
> --Reinier Zwitserloot
> Like it? Tip it!
> On Apr 6, 2009, at 23:31, Mark Thornton wrote:
>> alex wrote:
>>> Hi Tim,
>>> a little bit late comment...
>>> what if
>>> Map<String, List<String>> anagrams();
>>> compiled as
>>> Map<String, List<String>> anagrams = new HashMap<String,
>> Why HashMap and not some other implementation of Map? That approach
>> works if the LHS specifies a concrete type and not an interface or
>> abstract class.
>> Mark Thornton
More information about the coin-dev