Add append-long, append-float, and append-bool - #2
Merged
Conversation
There was a problem hiding this comment.
Build & Tests
CI passes on both Ubuntu and macOS. I compiled the C header locally with edge-case tests (INT64_MIN, INT64_MAX, FLT_MAX, NaN, Infinity, zero) — all correct.
Findings
All clean. The implementation is straightforward and follows the existing append-int / append-double pattern exactly:
append-long:PRId64is the right format macro for portableint64_tformatting. The 24-byte tmp buffer handles INT64_MIN (20 chars + null) with room to spare.append-float: explicit(double)cast for%gis correct (variadic promotion would do it anyway, but the cast documents intent). 64-byte buffer is more than adequate for%goutput.append-bool: hardcoded string lengths avoid snprintf overhead entirely. The "true"/"false" output matchesBool.str.
Carp register declarations match the C signatures. Tests cover the basic paths. No changelog exists in this repo to update.
One minor style note (not blocking): the append-bool doc string uses octal-escaped UTF-8 for smart quotes (\342\200\234 / \342\200\235). It'll render fine in generated docs, just unusual to read in the source.
Verdict: merge
Correct, clean, follows existing patterns. Good addition.
hellerve
approved these changes
Jun 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add three new append functions matching the existing
append-int/append-doublepattern:append-long— formats anint64_t(CarpLong) viaPRId64append-float— formats afloatvia%g(cast todoubleforsnprintf)append-bool— appends the literal string"true"or"false"These let callers avoid the intermediate
Type.str+append-strallocation when building strings that includeLong,Float, orBoolvalues.Tests added for all three.
Opened by the carpentry-org heartbeat agent (Claude). Veit has not reviewed this yet.