Port Syntax::Keyword::Try using the parser keyword extension

Aberta
#2,056 2 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
5/5
Tempo estimado
Mais de uma semana
Facilidade para iniciantes
12/100
Tipo de issue
Funcionalidade
Clareza
Razoavelmente clara
Status de atividade
Ativa
Stack de tecnologia
java, perl
Domínio
compilers

Direção de pesquisa

This is parser-keyword provider work built on the merged parser extension API from #1292 and PR #1883, so start with the keyword-plugin code those reference rather than the CPAN module. Read how the Function::Parameters provider registers keywords and lowers to the shared AST, then plan the try/catch/finally nodes. Done means the focused tests for normal, thrown, finally, return and lexical-scope cases pass on both JVM and interpreter backends.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

area:cpan-port area:parser enhancement

Summary

Add a PerlOnJava provider for Syntax::Keyword::Try using the parser keyword extension and shared AST. The CPAN distribution implements try/catch/finally as parser syntax; its XS implementation cannot load in PerlOnJava, but a parser-backed provider can support the language behavior without porting the Perl 5 XS ABI.

Motivation and evidence

The archived CPAN run 20261112-134536-63590 tested Data::Structure::Deserialize::Auto 1.01. Its nine failing test programs all aborted while loading Syntax::Keyword::Try with no Java XS implementation available, before reaching deserialization assertions. The target imports Syntax::Keyword::Try unconditionally.

I installed the target and its prerequisites into an isolated temporary library and ran its unmodified suite with system Perl 5.34.1. All 10 test programs and 11 tests passed. Syntax::Keyword::Try 0.31 and its XS parser dependency compiled under system Perl; its own test suite passed. This confirms the PerlOnJava failure is the missing parser-syntax provider, not a failure in the target module's behavior.

MetaCPAN's reverse-dependency endpoint reported 67 raw candidate records. Of the 50 records returned on its first page, 49 unique released distributions declare Syntax::Keyword::Try as a required runtime dependency; all 49 were released in the five-year window beginning 2021-11-13. Examples include Data-Structure-Deserialize-Auto, Workflow, Mojo-Darkpan, MCP-Wiki, Feature-Compat-Try, and Zydeco. The endpoint returned an empty second page, so 49 is a verified lower bound for both unique runtime dependants and recent dependants, not a complete count.

Existing parser work

  • #1292 introduced the parser keyword-plugin API.
  • PR #1883 merged that API and the Function::Parameters provider on 2026-10-26.
  • #1361 tracks the Function::Parameters consumer and its remaining compatibility gaps.

This issue tracks a separate provider that uses the now-merged parser extension capability.

Suggested scope

Implement a documented useful subset of Syntax::Keyword::Try using the shared AST consumed by both backends. Start with try and catch, then add finally with Perl-compatible cleanup and exception propagation. Preserve behavior for return and loop-control statements where supported by the parser/runtime. Keep imports and keyword activation scoped to the compiling lexical context. Explicitly document and diagnose unsupported module options or experimental syntax.

Do not use a source filter or attempt to load the CPAN XS object. Reuse the parser-plugin lifecycle from #1292 and add project-owned tests validated against system Perl first.

Acceptance criteria

  • A bundled provider loads Syntax::Keyword::Try on JVM and interpreter backends without XS loading.
  • Focused tests cover normal completion, thrown and caught exceptions, optional catch variables, finally execution, exception propagation, return behavior, and lexical activation/removal.
  • The upstream Syntax::Keyword::Try tests that match the supported subset pass, and Data::Structure::Deserialize::Auto 1.01 progresses past module loading on both backends.
  • Unsupported syntax fails with a source-located diagnostic; it is not silently treated as ordinary Perl code.
Linguagem predominante
Perl
Estrelas
67
Forks
8
Merge médio
5h 12min
PRs com merge (30d)
131

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de fglock/PerlOnJava

Todas as issues de fglock/PerlOnJava

Issues semelhantes

Mais issues de Perl

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.