Give the generated handles the pointer boundary a caller can cross - #20
Merged
estebanzimanyi merged 1 commit intoSep 3, 2026
Conversation
WITNESS: the root `gomeos` package calls 681 distinct MEOS C symbols by hand, and every one of them already has a wrapper in the generated `functions` package -- 3554 wrapped symbols plus 62 `#define` aliases. The hand-written package nevertheless imports `functions` 0 times, and it cannot: a cgo type belongs to the package that declares it, so this package's `*C.Temporal` and the generated package's `*C.Temporal` are different Go types, and `Inner()` returns one of them. Nothing in the generated surface exposes a type both packages can name. MEASURED: the emitter gives each opaque handle a `Pointer()` method and a `<T>FromPointer` constructor over `unsafe.Pointer`, which is the same contract MEOS.NET's generated handles already carry as IntPtr. Three examples cross the boundary in both directions: a sequence built here reads back through `TemporalNumInstants` and `TemporalSubtype` as 3 and `Sequence`; the pointer compares equal after the round trip, so the handle is carried rather than what it points at; and `TemporalFromPointer(nil)` answers a nil handle whose `Pointer()` is nil. The suite reads 118 result lines, 0 skipped, against 115 before, and the floor moves with it. `functions/meos_meos_pointcloud.go` moves because regeneration takes the catalog as it stands and MEOS publishes two more point cloud entries than the committed snapshot carries; the snapshot is a projection, so it follows. WHY: a binding is a projection of the catalog, and the hand-written package duplicates 7377 lines of a surface the generator already produces -- including `TBoolValueAtTimestamp`, which composes `temporal_at_timestamptz` with `TBoolStartValue` where MEOS publishes `tbool_value_at_timestamptz` and the generated package wraps it. Retiring that duplication needs the two packages to exchange a handle, and the pointer is the only type they can both name. This adds no signature and removes none.
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.
WITNESS: the root
gomeospackage calls 681 distinct MEOS C symbols by hand,and every one of them already has a wrapper in the generated
functionspackage -- 3554 wrapped symbols plus 62
#definealiases. The hand-writtenpackage nevertheless imports
functions0 times, and it cannot: a cgo typebelongs to the package that declares it, so this package's
*C.Temporalandthe generated package's
*C.Temporalare different Go types, andInner()returns one of them. Nothing in the generated surface exposes a type both
packages can name.
MEASURED: the emitter gives each opaque handle a
Pointer()method and a<T>FromPointerconstructor overunsafe.Pointer, which is the same contractMEOS.NET's generated handles already carry as IntPtr. Three examples cross the
boundary in both directions: a sequence built here reads back through
TemporalNumInstantsandTemporalSubtypeas 3 andSequence; the pointercompares equal after the round trip, so the handle is carried rather than what
it points at; and
TemporalFromPointer(nil)answers a nil handle whosePointer()is nil. The suite reads 118 result lines, 0 skipped, against 115before, and the floor moves with it.
functions/meos_meos_pointcloud.gomoves because regeneration takes thecatalog as it stands and MEOS publishes two more point cloud entries than the
committed snapshot carries; the snapshot is a projection, so it follows.
WHY: a binding is a projection of the catalog, and the hand-written package
duplicates 7377 lines of a surface the generator already produces -- including
TBoolValueAtTimestamp, which composestemporal_at_timestamptzwithTBoolStartValuewhere MEOS publishestbool_value_at_timestamptzand thegenerated package wraps it. Retiring that duplication needs the two packages to
exchange a handle, and the pointer is the only type they can both name. This
adds no signature and removes none.