spec: string-buffer primitive — make-string-buffer/append!/->string/length

OCaml: StringBuffer of Buffer.t in sx_types.ml; 5 primitives in
sx_primitives.ml (make-string-buffer, string-buffer?, string-buffer-append!,
string-buffer->string, string-buffer-length); inspect case added.

JS: SxStringBuffer with array+join backend; _string_buffer marker for
typeOf dispatch and dict? exclusion (also excludes _vector from dict?).

spec/primitives.sx: 5 define-primitive entries.
17/17 tests pass on both OCaml and JS.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-26 17:05:05 +00:00
parent cc0af51921
commit d98b5fa223
7 changed files with 190 additions and 4 deletions

View File

@@ -798,4 +798,10 @@
:returns "list"
:doc "Parse SX source string into a list of AST expressions.")
(define-primitive
"make-string-buffer"
:params ()
:returns "string-buffer"
:doc "Create a new empty mutable string buffer for O(1) amortised append.")
(define-module :stdlib.coroutines)