RFR: 8302344: Compiler Implementation for Unnamed patterns and variables (Preview) [v12]
Jan Lahoda
jlahoda at openjdk.org
Fri May 5 09:29:49 UTC 2023
On Thu, 4 May 2023 23:19:26 GMT, Aggelos Biboudis <abimpoudis at openjdk.org> wrote:
>>>
>>
>> For the user-facing javax.lang.model languages, I think the current convention of "empty name means unnamed" is reasonable and is consistent with how other unnamed items are handled in that API.
>>
>> I assumed for the lower-level tree API "_" would be a more appropriate choice, but I'm open to discussions alternative conventions there.
>
> Recently, I realized that `names.empty` also signifies an error in `variableDeclaratorId` in some occasion around lambdas: https://github.com/openjdk/jdk/blob/ffae4e0e97b19b1c1ad2865ed618ba380a861b7e/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java#L3688-L3697
> I don't believe that this would be a blocker but it could pose a possible minor challenge.
FWIW, I don't have a strong opinion on whether the name in the AST should be empty or underscore. (But I agree empty name is more consistent in the Language Model.) For missing names where names are expected (which is the above case), we could revisit later, there are more cases like this.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13528#discussion_r1185869588
More information about the kulla-dev
mailing list