Skip to content

Commit 3e75045

Browse files
fglockDevin
andcommitted
Update Moo design doc with Phase 24-25 fixes
- Phase 24: Fix ::identifier bareword parsing - Phase 25: Fix self-referential hash assignment Mo: 27/28 passing (99.3%) Moo: 62/71 passing (87%), 768/829 subtests (93%) Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <noreply@cognition.ai>
1 parent a3233cd commit 3e75045

1 file changed

Lines changed: 31 additions & 3 deletions

File tree

dev/design/moo_support.md

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -589,11 +589,34 @@ Moo tests run via `jcpan -t Moo`. Recent fixes (Phases 12-13) should improve pas
589589
- This fixes Sub::Quote's `local @_ = ($value)` inlinification pattern
590590
- Fixes t/method-generate-accessor.t (46/49 → 49/49)
591591
592+
- [x] Phase 24: Fix ::identifier bareword parsing (2026-03-16)
593+
- Root cause: `::foo` without parens was always treated as `main::foo` identifier
594+
- In Perl: `::foo` calls main::foo only if sub exists at compile time, else bareword string
595+
- Mo uses `$M.$_.::e` to build package names - `::e` should be bareword string
596+
- But tests use `::is ::exception { }` where `is` and `exception` are imported subs
597+
- **ParsePrimary.java fix**:
598+
- Check `GlobalVariable.getGlobalCodeRef(fullSubName).getDefinedBoolean()`
599+
- If sub exists OR followed by `(`: function call (main::identifier)
600+
- If sub doesn't exist AND no parens: bareword string ('::identifier')
601+
- **config.yaml fix**: Added cpan script to sync config for jcpan wrapper
602+
- **.gitignore fix**: Allow src/main/perl/bin/ directory in git
603+
- Mo tests: 27/28 passing (99.3%)
604+
605+
- [x] Phase 25: Fix self-referential hash assignment (2026-03-16)
606+
- Root cause: `%h = (new_stuff, %h)` was clearing hash before evaluating `%h`
607+
- Mo uses: `%e = (extends => sub{...}, has => sub{...}, %e)` to merge exports
608+
- The hash was cleared before iterating over the RHS list containing `%h`
609+
- **RuntimeHash.java fix**:
610+
- Materialize entire RHS list into temporary array BEFORE clearing hash
611+
- Similar to how tied hashes are already handled
612+
- This fixed Mo's BUILD feature which depends on the %e merge pattern
613+
- Mo tests: 6/28 failing → 1/28 failing (143/144 subtests pass)
614+
592615
### Current Status
593616
594-
**Test Results (after Phase 23):**
595-
- 62/71 test programs passing (87%)
596-
- ~768/829 subtests passing (93%)
617+
**Test Results (after Phase 25):**
618+
- **Moo**: 62/71 test programs passing (87%), 768/829 subtests passing (93%)
619+
- **Mo**: 27/28 test programs passing (99.3%), 143/144 subtests passing
597620
598621
**Remaining Failures (categorized):**
599622
1. **accessor-weaken tests** (20 failures) - Expected, weak references not supported in Java GC
@@ -602,6 +625,7 @@ Moo tests run via `jcpan -t Moo`. Recent fixes (Phases 12-13) should improve pas
602625
4. **moo-utils-_subname-Sub-Name.t** (1 failure) - Expected, we have Sub::Util (no fallback to Sub::Name)
603626
5. **no-moo.t** (5 failures) - Namespace cleanup requires weak references
604627
6. **overloaded-coderefs.t** - Expected, B::Deparse not available
628+
7. **Mo t/strict.t** (1 failure) - Error message format differs from Perl
605629
606630
**Expected failures** (not fixable without fundamental changes):
607631
- Weak references: accessor-weaken tests (20), no-moo.t cleanup (5)
@@ -621,12 +645,16 @@ Moo tests run via `jcpan -t Moo`. Recent fixes (Phases 12-13) should improve pas
621645
### PR Information
622646
- **Branch**: `feature/moo-support` (PR #319 - merged)
623647
- **Branch**: `fix/goto-tailcall-import` (PR #320 - open)
648+
- **Branch**: `fix/mo-bareword-parsing` (PR #322 - open)
624649
- **Key commits**:
625650
- `00c124167` - Fix print { func() } filehandle block parsing and JVM codegen
626651
- `393bedf0f` - Fix quotemeta and Package::SUPER::method resolution
627652
- `7a76739b8` - Fix goto &sub in use/import TAILCALL handling
628653
- `053d91a95` - Add Sub::Util, fix Scalar/List::Util VERSION, add Test::Harness
629654
- `7993ef74d` - Fix version parsing and MM->parse_version for CPAN.pm
655+
- `db434f8d3` - Fix ::identifier bareword parsing and add cpan to sync
656+
- `ff31163f9` - Fix self-referential hash assignment %h = (stuff, %h)
657+
- `a3233cd55` - Improve ::identifier to check sub existence at compile time
630658
631659
## Related Documents
632660

0 commit comments

Comments
 (0)