Skip to content

fix: UNIVERSAL::can list parity + concat encoding; Sub::HandlesVia plan#743

Closed
fglock wants to merge 3 commits into
masterfrom
feature/sub-handlesvia-can-concat-encoding
Closed

fix: UNIVERSAL::can list parity + concat encoding; Sub::HandlesVia plan#743
fglock wants to merge 3 commits into
masterfrom
feature/sub-handlesvia-can-concat-encoding

Conversation

@fglock
Copy link
Copy Markdown
Owner

@fglock fglock commented May 15, 2026

Summary

  • UNIVERSAL::can — When no method exists, Perl returns (undef) in list context (one-element list). PerlOnJava previously returned an empty list, which breaks implicit hash literals (the next pairing is consumed). Mite __META__ then misclassified HAS_BUILDARGS, and Sub::HandlesVia::CodeGenerator->new took the bogus BUILDARGS path. Failures now return scalarUndef.getList().

  • String SvUTF8 parity — Added RuntimeScalar(String, int stringType) and updated stringConcat, stringConcatWarnUninitialized, and stringConcatNoOverload to assign STRING vs BYTE_STRING from operands and wide-character scans (see dev/design/utf8_flag_parity.md).

  • Planning docdev/modules/sub_handlesvia_support.md records completed fixes and P0–P3 next steps (\x{c2} failure inside Eval::TypeTiny::eval_closure, full jcpan run, regression-test coordination). dev/modules/README.md indexes the doc.

Design notes: dev/design/string_encoding_context_plan.md (investigation correction), dev/design/utf8_flag_parity.md (sections 2b/2c).

Test plan

  • make
  • Smoke: Sub::HandlesVia::CodeGenerator->__META__ has HAS_FOREIGNBUILDARGS and HAS_BUILDARGS (undef) after load
  • timeout 3600 ./jcpan -t Sub::HandlesVia (optional; lengthy)
  • After P0 (eval_closure UTF-8): timeout 900 ./jperl -Iblib/lib …/Sub-HandlesVia/t/02moo.t

@fglock fglock force-pushed the feature/sub-handlesvia-can-concat-encoding branch from 7053ad5 to 79a6728 Compare May 15, 2026 14:47
@fglock
Copy link
Copy Markdown
Owner Author

fglock commented May 15, 2026

Update (regressions): The StringOperators concat + RuntimeScalar(String,int) slice from the first push regressed perl5_t harness counts on op/sub.t, porting/filenames.t, and re/pat_advanced.t. Latest commit reverts concat to master parity and removes the unused ctor; the UNIVERSAL::canscalarUndef.getList() fix stays. See dev/modules/sub_handlesvia_support.md §P2 for guarded redo steps before re-landing concat semantics.

fglock and others added 2 commits May 15, 2026 18:25
…andling

Failures from can() returned an empty list, corrupting Mite __META__
hash literals and breaking Sub::HandlesVia constructor dispatch.
Returned values now use singleton undef matching Perl list semantics.

Add RuntimeScalar(String, int stringType) and route concatenation helpers
through explicit STRING vs BYTE_STRING selection.

Document Sub::HandlesVia next steps under dev/modules/.

Generated with Cursor (https://cursor.com/docs)

Co-Authored-By: Cursor <noreply@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
StringOperators stringConcat* and RuntimeScalar(String,int) regressed perl5_t
smoke (op/sub.t, porting/filenames.t, re/pat_advanced.t). Restore the prior
concat implementation; retain scalarUndef.getList() on failed can() for Mite.

Update design + dev/modules docs with the revert and a safer redo checklist.

Generated with Cursor (https://cursor.com/docs)

Co-Authored-By: Cursor <noreply@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@fglock fglock force-pushed the feature/sub-handlesvia-can-concat-encoding branch from 0af8d22 to 5d90443 Compare May 15, 2026 16:25
Returning a singleton undef on every can() miss fixed Mite list/hash pairings
but confused compile-time probe sites that expect an empty RuntimeList
(VERSION/import/MODIFY_* checks). Use list-context undef only when ctx is
LIST; keep an empty list for scalar-like contexts (scalar() still undef).

Updated design notes and Sub::HandlesVia tracking doc.

Generated with Cursor (https://cursor.com/docs)

Co-Authored-By: Cursor <noreply@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
fglock added a commit that referenced this pull request May 15, 2026
Unify both lines of work for combined testing before merge to master.
@fglock fglock closed this May 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant