Skip to content

Expand Object::Pad compatibility with :accessor fields #1177

Description

@fglock

Summary

Expand PerlOnJava's Object::Pad compatibility beyond the native compiler's
core class, field, and method syntax. In particular, support the
Object::Pad field attribute :accessor.

PerlOnJava currently advertises Object::Pad 0.66, so optional CPAN tests
guarded by Test::Requires 'Object::Pad' run. However, both backends reject
Object::Pad-specific MOP syntax such as :accessor at compile time.

Reproducer

use Object::Pad;

class Example {
    has $value : accessor = 'value';
}

Standard Object::Pad accepts this declaration. PerlOnJava reports a syntax
error near : accessor = on both the JVM and interpreter backends.

CPAN evidence

MooseX::LocalAttribute 0.05 regressed in CPAN tester run
20260827-171022-1876. All of its non-Object::Pad tests pass. Its optional
t/objectpad.t runs because Object::Pad is present, then cannot compile
Tester::ObjectPad, which declares two fields using :accessor.

The current feature matrix already documents that Object::Pad MOP extensions
are not included; this issue tracks closing that compatibility gap rather than
an undocumented semantic regression.

Ecosystem impact

MetaCPAN reports 135 unique reverse-dependant distributions for Object::Pad,
including 31 updated in the preceding 12 months. Recent dependants include
OpenTelemetry, DBIx-Fast, Device-Chip, Sys-Async-Virt, and
Object-PadX-Enum. Those counts cover all Object::Pad APIs, not only
:accessor, but demonstrate material ecosystem relevance.

Suggested scope and acceptance coverage

  • Parse and implement has $field :accessor = EXPR with Object::Pad-compatible
    generated accessors and initialization behavior.
  • Define the supported Object::Pad extension surface explicitly, so a module
    is not presented as fully compatible merely because core class syntax works.
  • Add focused project-owned tests for :accessor fields and generated
    read/write accessors on both backends.
  • Use MooseX::LocalAttribute t/objectpad.t as downstream regression
    coverage.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions