Build a temporal value from an array of temporal values - #25
Merged
estebanzimanyi merged 1 commit intoSep 2, 2026
Merged
Conversation
MEOS reads an array of its own values through a pointer to the first element and a count — `tsequence_make`, `tsequenceset_make`, `temporal_merge_array` and the trgeometry twin of each. The object layer takes that as one C# array: the wrappers' pointers are gathered into an `IntPtr[]` and pinned across the call. The pin lasts exactly that long because the array is the caller's throughout — `tsequence_make_free` is the twin that takes ownership, and it does so by calling `tsequence_make` and then `pfree_array` on the array it passed, which is sound only if `tsequence_make` neither frees nor retains it. Eight constructors reach the object layer that way, 611 methods against 607. The length parameter never appears in the C# signature, so it cannot disagree with the array. That also settles which parameter is an array at all: the length is named `count`, while a parameter named `n` is the index of the `*_n` accessors, whose pointer is the receiver and no array — reading `n` as a length turns `trgeometry_instant_n(temp, n)` into a call passing the receiver's own length. Three tests: a sequence made of three instants reads back as the text of all three, merging two sequences answers four instants across two sequences, and an empty array reaches MEOS as the invalid argument it is.
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.
MEOS reads an array of its own values through a pointer to the first element
and a count —
tsequence_make,tsequenceset_make,temporal_merge_arrayand the trgeometry twin of each. The object layer takes that as one C# array:
the wrappers' pointers are gathered into an
IntPtr[]and pinned across thecall. The pin lasts exactly that long because the array is the caller's
throughout —
tsequence_make_freeis the twin that takes ownership, and itdoes so by calling
tsequence_makeand thenpfree_arrayon the array itpassed, which is sound only if
tsequence_makeneither frees nor retains it.Eight constructors reach the object layer that way, 611 methods against 607.
The length parameter never appears in the C# signature, so it cannot disagree
with the array. That also settles which parameter is an array at all: the
length is named
count, while a parameter namednis the index of the*_naccessors, whose pointer is the receiver and no array — reading
nas alength turns
trgeometry_instant_n(temp, n)into a call passing thereceiver's own length.
Three tests: a sequence made of three instants reads back as the text of all
three, merging two sequences answers four instants across two sequences, and
an empty array reaches MEOS as the invalid argument it is.