Skip to content

Implement gawk array sorting and type-introspection builtins #454

@bertysentry

Description

@bertysentry

Problem

This is a focused follow-up to umbrella issue #80. The latest mvn verify run for GawkCompatibilityIT shows a concrete compatibility cluster around gawk's array sorting and type-introspection features.

Observed impact:

  • 13 failing Gawk compatibility cases in the latest run
  • Representative cases: asort, asorti, aasort, aasorti, asortbool, asortsymtab, sort1, arraytype, mdim1, typeof2, typeof4, typeof5, typeof6
  • Current failure mode is typically SemanticException: function ... (asort|asorti|typeof)

The failing cases suggest that we need more than stub builtin registration. Jawk also needs the corresponding runtime behavior that gawk expects for:

  • asort()
  • asorti()
  • typeof()
  • typed / untyped / array value distinctions that those functions expose

Specification

Read how asort() and asorti() functions works.

Read how typeof() function works

Implement these in a builtin Jawk extension, named GawkExtension. Make it enabled by default (when no extensions are specified by the caller, and notably in the Cli).

Acceptance criteria:

  • the representative cases above pass in GawkCompatibilityIT
  • asort() and asorti() work on plain arrays and nested arrays where gawk allows them (and also Java Map and List)
  • typeof() returns gawk-compatible categories for the cases covered by the suite
  • sorting and introspection behavior is wired into the real runtime model, not only the parser

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions