Skip to content

feat(#5226): wire up-cased/low-cased to tt.as-ascii#5227

Merged
yegor256 merged 7 commits into
objectionary:masterfrom
asmirnov-backend:feat/5226/use-as-ascii
Jun 23, 2026
Merged

feat(#5226): wire up-cased/low-cased to tt.as-ascii#5227
yegor256 merged 7 commits into
objectionary:masterfrom
asmirnov-backend:feat/5226/use-as-ascii

Conversation

@asmirnov-backend

@asmirnov-backend asmirnov-backend commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Closes #5226.

tt.as-ascii was added in #4752 as a standalone object that reads a single character as its ASCII numeric value (0-255), but it had no production callers.

This PR wires it in:

  • tt.up-cased — removes the private nested [char] > ascii helper and calls tt.as-ascii instead.
  • tt.low-cased — replaces the (up-cased text).ascii ... expressions with direct tt.as-ascii calls, computes distance locally, and drops the +alias tt.up-cased, fully removing the dependency on up-cased internals.

Replaces the private nested `[char] > ascii` helper in `tt.up-cased`
with the standalone `tt.as-ascii` object (added in objectionary#5219), and rewires
`tt.low-cased` to call `tt.as-ascii` directly instead of borrowing the
helper through the awkward `(up-cased text).ascii` expression.

This removes the duplicated ASCII-decoding logic and drops the implicit
dependency of `low-cased` on `up-cased`'s internals.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

🚀 Performance Analysis

All benchmarks are within the acceptable range. No critical degradation detected (threshold is 100%). Please refer to the detailed report for more information.

Click to see the detailed report
Test Base Score PR Score Change % Change Unit Mode
benchmarks.XmirBench.xmirToEO 11407.730 11685.006 277.276 2.43% ms/op Average Time

⚠️ Performance loss: benchmarks.XmirBench.xmirToEO is slower by 277.276 ms/op (2.43%)

@asmirnov-backend

Copy link
Copy Markdown
Contributor Author

@yegor256, could you please take a look

@maxonfjvipon maxonfjvipon left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for wiring in tt.as-ascii. The up-cased half is solid, but the low-cased decoupling is incomplete and the description overstates what landed.

Looks good

  • up-cased: the nested [char] > ascii is gone and every use (code, maxcode, mincode, and the as-ascii "A" inside distance) now goes through tt.as-ascii. The swap is behavior-preserving — the old helper padded to as-i64 (seven 00-) and as-ascii pads to as-i16 (one 00-), but both yield the same 0–255 value for a single byte.
  • Keeping +unlint redundant-object is the right call. It guards the shared reduced / [accum byte] >> structure, not the removed helper — low-cased carries the same pragma and never had an ascii object, so dropping it would break the lint.

Needs a change

low-cased still depends on up-cased internals. Line 28 keeps:

code.plus (up-cased text).distance

and +alias tt.up-cased is still present, so a whole up-cased is instantiated just to read its inner distance. The dependency dropped from four reaches to one, not to zero — yet the description says this PR is "dropping the implicit dependency on up-cased internals", which isn't the case.

To actually close it, compute the distance locally and drop the alias:

minus. > distance
  as-ascii "a"
  as-ascii "A"

then code.plus distance, and remove +alias tt.up-cased.

Nit

as-ascii was introduced in #4752 (commit 5e0d031), not #5219.

asmirnov-backend and others added 2 commits June 19, 2026 18:14
Compute distance locally in low-cased and drop the +alias tt.up-cased

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@asmirnov-backend

asmirnov-backend commented Jun 19, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the thorough review, @maxonfjvipon.

You're right that low-cased was still reaching into up-cased. Fixed in 6edb8dc:

asmirnov-backend and others added 4 commits June 19, 2026 19:07
Make maxcode, mincode and distance constants so the redundant-object
lint no longer flags them, then remove +unlint redundant-object. Sort
the alias metas by label so as-ascii leads.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Move +alias tt.as-ascii ahead so the alias metas are ordered by label,
clearing the unsorted-metas lint warning.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Restore +unlint redundant-object and revert maxcode, mincode and
distance to non-constant, keeping low-cased consistent with up-cased.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@yegor256

Copy link
Copy Markdown
Member

@maxonfjvipon take a look again please

@yegor256 yegor256 merged commit c032001 into objectionary:master Jun 23, 2026
26 checks passed
@sonarqubecloud

Copy link
Copy Markdown

@0crat

0crat commented Jun 23, 2026

Copy link
Copy Markdown

@maxonfjvipon Thanks for the review! You've earned +4 points for this: +12 as a basis; -8 for absolutely no comments posted; -4 for too few (30) hits-of-code; +4 to give you at least something. Your running score is +226; don't forget to check your Zerocracy account too).

@0crat

0crat commented Jun 23, 2026

Copy link
Copy Markdown

@asmirnov-backend Thanks for the contribution! You've earned +12 points for this: +16 as a basis; -4 for too few (30) hits-of-code. Please, keep them coming. Your running score is +120; don't forget to check your Zerocracy account too).

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.

Redundant usage of private ascii helper in up-cased and low-cased instead of tt.as-ascii

4 participants