Implement Perl-compatible restricted-hash semantics
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 45/100
調査の方向性
The issue is about implementing restricted-hash semantics in Hash::Util for both JVM and interpreter backends. Start by examining the existing Hash::Util module code in the PerlOnJava repository, likely in lib/Hash/Util.pm or similar. Review the failing tests in dev/tools/feature-audit/remaining_semantics.t and the CPAN test failures from MooX::Params::CompiledValidators. Understand Perl's native behavior by testing the reproduction script with a standard Perl interpreter. The work involves modifying core hash operations across two backends, so familiarity with the project's internals is essential. Done means the reproduction script behaves like native Perl and the existing audit tests pass.
索引モデルが issue の本文から書いたものです。
説明
Summary
Implement Perl-compatible restricted-hash semantics for Hash::Util on both the JVM and interpreter backends.
Current behavior
The bundled Hash::Util exposes several restricted-hash APIs, but key-locking is a no-op and the remaining operations are only partially implemented:
lock_keysandunlock_keysare registered but do not change hash behavior.lock_valueandunlock_valueare compatibility no-ops.lock_keys_plusis a no-op.lock_hashprevents some writes, but does not reject reads of missing keys and does not consistently reproduce Perl's restricted-hash diagnostics.- Inspection helpers such as
hash_lockedandhash_unlockedreturn placeholder values.
The feature matrix currently marks restricted hashes unsupported. docs/reference/bundled-modules.md should also be reconciled because it currently lists Hash::Util as providing lock_keys and lock_hash without describing the partial semantics.
Reproduction
use Hash::Util qw(lock_keys lock_hash);
my %keys = (a => 1);
lock_keys(%keys, 'a');
my $added = eval { $keys{b} = 2; 1 };
my $read = eval { my $value = $keys{b}; 1 };
my %hash = (a => 1);
lock_hash(%hash);
my $missing = eval { my $value = $hash{b}; 1 };
Native Perl rejects the disallowed-key operations. PerlOnJava currently allows the lock_keys add/read operations and the lock_hash missing-key read on both backends.
Compatibility evidence
CPAN distribution MooX::Params::CompiledValidators v0.05 failed 3 of 17 tests under PerlOnJava in run 20260922-180448-60378:
t/010-basic.t: restricted-hash access was not rejected.t/020-moose.t: restricted-hash access was not rejected.
Under system Perl, those two test files pass. The third file has an unrelated warning-sensitive Type::Tiny serialization failure.
The smallest direct probe also reproduces the backend gap: native Perl reports Attempt to access disallowed key, while both JVM and interpreter return without an error.
Proposed scope
- Implement key restrictions and enforcement for read, write, delete, and key creation.
- Implement whole-hash and value locking/unlocking with Perl-compatible state transitions.
- Implement
lock_keys_plusand inspection helpers with correct results. - Match Perl's relevant error behavior where practical.
- Add project-owned unit tests covering both backends and validate expected behavior with standard Perl.
- Update the bundled-modules documentation to distinguish implemented APIs from partial/no-op compatibility shims.
References
dev/tools/feature-audit/remaining_semantics.talready records restricted-hash enforcement as failing on both backends.dev/design/feature-audit-plan.mdrecords this as a known unsupported gap.
- 主要言語
- Perl
- スター
- 64
- フォーク
- 6
- 平均マージ
- 5時間 38分
- マージ済み PR(30日)
- 170
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
fglock/PerlOnJava のほかの issue
-
area:cpan-port area:unicode bug
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
fglock/PerlOnJava#1341 ·
-
area:backend area:runtime bug
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
fglock/PerlOnJava#1511 ·
-
area:backend area:cpan-port bug
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
fglock/PerlOnJava#1508 · コメント 1 件 ·
-
area:cpan-port area:platform enhancement
難易度 5/5 1週間以上 初心者へのやさしさ 30/100
fglock/PerlOnJava#1507 ·
-
bug
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
fglock/PerlOnJava#1506 ·
fglock/PerlOnJava の issue をすべて見る
似ている issue
-
documentation Needs Triage
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
trizen/youtube-viewer#456 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
-
connectivity オープン
難易度 1/5 1時間未満 初心者へのやさしさ 80/100
-
Common US ingredient names are not recognized, so about 12.4k US products miss an allergen warning オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
openfoodfacts/openfoodfacts-server#14657 · コメント 4 件 ·