Warning about single underscore identifier
Matthew Adams
matthew at matthewadams.me
Thu Aug 1 05:57:58 PDT 2013
Brian, will the same policy hold for "$"?
-matthew
On Wed, Jul 31, 2013 at 1:52 PM, Brian Goetz <brian.goetz at oracle.com> wrote:
> Yes, we are "reclaiming" the syntactic real estate of "_" from the space
> of identifiers for use in future language features. However, because there
> are existing programs that might use it, it is a warning for identifiers
> that occur in existing syntactic positions for 8, and an error for lambda
> formals (since there is no existing code with lambdas.)
>
> Your suspicion is mostly right, except that we are certainly NOT going to
> do Scala's "wunderbar". However, things it might be used for include
> things like "I don't want to give this variable a name" (such as catch
> parameters that are never used.)
>
>
> On Jul 29, 2013, at 6:59 AM, Roel Spilker wrote:
>
> > Hi all,
> >
> > If I compile a java program containing an identifier consisting of just a
> > single underscore using the java 8 compiler, I get the following warning:
> >
> > warning: '_' used as an identifier
> > (use of '_' as an identifier might not be supported in releases after
> Java
> > SE 8)
> >
> > I suspect this is to allow for scalaesc parameters in lambdas.
> >
> > Can someone confirm my suspicion? Is this still relevant or is this a
> > left-over from an early design? Is there a valid reason to not support
> '_'
> > for all identifiers, or can it be only restricted for identifiers inside
> > lambdas, and therefore guaranteed new code, to maintain backwards source
> > compatibility.
> >
> > Roel
> >
>
>
>
--
mailto:matthew at matthewadams.me <matthew at matthewadams.me>
skype:matthewadams12
googletalk:matthew at matthewadams.me
http://matthewadams.me
http://www.linkedin.com/in/matthewadams
More information about the lambda-dev
mailing list