refactor(js)!: replace glendix/js/array with gleam_javascript array (#11) - #25
Merged
Merged
Conversation
Delegate glendix/js/array conversions to gleam/javascript/array and remove the handwritten JavaScript adapter and its externals. from_list and to_list keep their names, labels, and element-order behavior, so list |> array.from_list |> array.to_list is unchanged. The project's style gate forbids type aliases, so the former opaque JsArray(element) type cannot be preserved as a re-export and is removed; annotate values with gleam/javascript/array.Array(element) instead. This is a source-breaking change for callers that named JsArray explicitly, so bump the package to 6.0.0 and document the migration in the READMEs. Tests cover empty, singleton, and ordered Int round trips plus a String round trip for generic-element typing. glendix -> mendraw keeps its declared Hex source form. Closes #11.
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.
Summary
Closes #11. Delegates
glendix/js/arrayconversions togleam/javascript/arrayand removes the handwritten JavaScript adapter, so Glendix no longer owns
duplicate array runtime code.
Changes
src/glendix/js/array.gleam—from_listandto_listnow delegate togleam/javascript/array.from_list/to_list. Their names, labels, andelement-order behavior are unchanged, so
list |> array.from_list |> array.to_listkeeps working. The former opaque
JsArray(element)type is removed and itstwo private
@externaldeclarations are gone.src/glendix/js/array_ffi.mjs— deleted; nothing references it.test/glendix_test.gleam— round-trip tests now cover empty, singleton,and ordered
Intlists plus aStringlist for generic-element typing.gleam.toml+ READMEs/guides — version bumped to6.0.0and installranges updated; a migration note documents the
JsArrayremoval.Why
JsArraywas removed (not kept as a facade)The issue prefers preserving
JsArrayas a compatibility facade "if Gleam'stype-alias/export rules permit it." A transparent re-export would require a
pub type JsArray(element) = gleam/javascript/array.Array(element)alias, butthe family's mechanical style gate (
check-style.py, run by./scripts/verify.sh shared) forbids alltype X =aliases. Since this is apublic/shared boundary change, that gate must pass, so the alias cannot merge.
Per the issue's fallback ("document the required migration and treat the change
according to semantic-versioning policy"), the opaque type is removed and this
is treated as a breaking change:
from_list/to_listis source-compatible (the type wasopaque, so callers never constructed or matched it).
array.JsArray(T)must switch togleam/javascript/array.Array(T).5.1.0 -> 6.0.0; migration documented inREADME*.md.Acceptance criteria
from_list/to_listdelegate togleam/javascript/array; no handwritten JS remainssrc/glendix/js/array_ffi.mjsremovedJsArray) documented and versionedglendix -> mendrawretains its declared Hex dependency source formVerification (isolated worktree pinned to the pushed commit)
./scripts/verify.sh inner glendix— pass (52 tests,--runtime bun)scripts/check-style.py,scripts/check-ffi-contracts.py,scripts/check-boundaries.py— passscripts/family.sh deps-status—Summary: valid(mendraw stayshex)dependency-mode.sh check-commit glendix <tip>— valid