Yes, single underscore is restricted in Java the language but not as far as
I know at the JVM specification level.

I don't believe the leading underscore case is impacted at all by the
single case. My understanding is that Java is pathing the way for how
underscore is used in other languages, e.g. "_" could be used where we
currently use "it" or where ignored parameters/variables might come into
play. E.g. Scala allows "List(1, 2, 3) foreach println _".

We certainly have further decisions to make around the single underscore in
Groovy, e.g. we could support "def (_, ycoord, _) = getCoords3D()". But
again, I see no impact on leading underscores.

Cheers, Paul.


On Thu, Feb 11, 2021 at 8:08 PM Andres Almiray <aalmi...@gmail.com> wrote:

> As I recall the use of a single _ as variable name is restricted since
> JDK10 and will become an error in newer JDKs.
>
> Does the use of a leading _ in an identifier has been discouraged as well
> in newer JDKs? If so then we should do the same even of means breaking
> compatibility.
>
> Cheers
> Andres
>
> Sent from my primitive tricorder
>
> On 11 Feb 2021, at 10:58, Mario Garcia <mario.g...@gmail.com> wrote:
>
> 
> If it helps, I've seen some programmers with python background using the
> underscore in Groovy for method declaration. It seems they use the
> convention of the underscore prefix to note these methods aren't for public
> consumption.
>
> El jue, 11 feb 2021 a las 9:49, Paul King (<paul.king.as...@gmail.com>)
> escribió:
>
>>
>> Hi folks,
>>
>> I would be interested in any thoughts about the following issue:
>>
>> https://issues.apache.org/jira/browse/GROOVY-9936
>>
>> TL;DR There is an edge case where Groovy 3 (Parrot) behavior now differs
>> from the old parser. Even though an argument could be made either way as to
>> which behavior is better, I propose we align with the old parser.
>>
>> Proposed PR:
>>
>> https://github.com/apache/groovy/pull/1485
>>
>> Let me know your thoughts.
>>
>> Thanks, Paul.
>>
>>
>>
>> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
>>  Virus-free.
>> www.avast.com
>> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
>> <#m_-1318158497720742238_m_-5064115683895307916_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>>
>

Reply via email to