refactor: simplify accessor internals#29
Closed
Koan-Bot wants to merge 1 commit into
Closed
Conversation
…dispatch) - Move `require mro` to module load time instead of calling it on every new() invocation (#22) - Replace string eval for role require with block eval, eliminating a potential code injection vector (#25) - Unify hook dispatch: resolve coderef first (class → role chain), then single call site with single rollback path, removing duplicated _after_* rollback logic (#26) Closes #22, closes #25, closes #26 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
atoomic
approved these changes
Apr 11, 2026
Collaborator
Author
|
Same situation as #27 — this has merge conflicts and the codebase has evolved significantly since this was opened. The incremental fixes (hook cache, strict constructor timing, etc.) have addressed some of the same concerns. Let me know if you'd like me to rebase or if we should close this one. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Three targeted simplifications to
lib/Simple/Accessor.pmaddressing issues #22, #25, and #26.Why
require mrowas called on everynew()invocation inside the hot-path_all_attributes()— unnecessary sincemrois a core pragma that only needs loading once (optimization:require mrocalled inside hot-path function on everynew()#22)eval qq[require $module]inwith()is a code injection risk when a simpler block eval works — the module name is already validated by regex, but block eval is inherently safer (simplification: string eval used forrequirewhere a block eval suffices #25)_after_*rollback logic was copy-pasted in two branches of the accessor closure (class hook vs role hook), creating a maintenance trap for future rollback changes (duplication:_after_*rollback logic copy-pasted in two branches of the accessor #26)How
require mroto module top-level (load once atusetime)eval qq[require $module; 1]toeval { require $file; 1 }with::→/path conversionTesting
Full test suite passes (all existing tests cover these code paths — roles, hooks, builders, transitive composition, inheritance, MRO).
Closes #22, closes #25, closes #26
Quality Report
Changes: 1 file changed, 21 insertions(+), 23 deletions(-)
Code scan: clean
Tests: passed (OK)
Branch hygiene: clean
Generated by Kōan post-mission quality pipeline