Skip to content

feat(#4752): add tt.as-ascii object#5219

Merged
yegor256 merged 1 commit into
objectionary:masterfrom
asmirnov-backend:feat/4752/ascii
Jun 15, 2026
Merged

feat(#4752): add tt.as-ascii object#5219
yegor256 merged 1 commit into
objectionary:masterfrom
asmirnov-backend:feat/4752/ascii

Conversation

@asmirnov-backend

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

Copy link
Copy Markdown
Contributor

Part of #4752.

Adds a pure-EO tt.as-ascii object that reads a single character as its
ASCII numeric value (0-255), by widening the character's byte to the eight
bytes i64 expects and reading it back as a number.

It is a small helper needed by the pure-EO sprintf reimplementation.

@github-actions

github-actions Bot commented Jun 14, 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 11499.061 11399.721 -99.341 -0.86% ms/op Average Time

✅ Performance gain: benchmarks.XmirBench.xmirToEO is faster by 99.341 ms/op (0.86%)

@asmirnov-backend asmirnov-backend changed the title feat(#4752): add tt.ascii object feat(#4752): add tt.as-ascii object Jun 14, 2026
Part of objectionary#4752.

Adds a pure-EO `tt.as-ascii` object that reads a single character as its
ASCII numeric value (0-255), by widening the character's byte to the eight
bytes `i64` expects and reading it back as a number.

It is a small helper needed by the pure-EO `sprintf` reimplementation
(and shared by the `up-cased`/`low-cased` siblings, which today each carry
a private copy). Split into its own PR to keep the change small, mirroring
the earlier `tt.is-digit` PR (objectionary#5208).

The name follows the `as-...` value family of the core library
(`as-bytes`, `as-i64`, `as-number`) and pairs with the existing sibling
`tt.is-ascii`. It ships with inline `+>` tests covering the boundaries of
the upper-case (`A`/`Z`), lower-case (`a`/`z`) and digit (`0`/`9`) ranges,
plus space, punctuation (`!`) and the last printable character (`~`).

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

Copy link
Copy Markdown

@asmirnov-backend

Copy link
Copy Markdown
Contributor Author

@yegor256, could you please take a look

@yegor256
yegor256 merged commit 3e8c122 into objectionary:master Jun 15, 2026
26 checks passed
@0crat

0crat commented Jun 17, 2026

Copy link
Copy Markdown

@asmirnov-backend Thanks for the contribution! You've earned +16 points. Please, keep them coming. Your running score is +44; don't forget to check your Zerocracy account too).

yegor256 pushed a commit that referenced this pull request Jun 23, 2026
Replaces the private nested `[char] > ascii` helper in `tt.up-cased`
with the standalone `tt.as-ascii` object (added in #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>
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.

3 participants