Skip to content

Give the generated handles the pointer boundary a caller can cross - #20

Merged
estebanzimanyi merged 1 commit into
MobilityDB:mainfrom
estebanzimanyi:feat/generated-pointer-boundary
Sep 3, 2026
Merged

Give the generated handles the pointer boundary a caller can cross#20
estebanzimanyi merged 1 commit into
MobilityDB:mainfrom
estebanzimanyi:feat/generated-pointer-boundary

Conversation

@estebanzimanyi

Copy link
Copy Markdown
Member

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.

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.
@estebanzimanyi
estebanzimanyi merged commit a26ad07 into MobilityDB:main Sep 3, 2026
2 checks passed
@estebanzimanyi
estebanzimanyi deleted the feat/generated-pointer-boundary branch September 3, 2026 01:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant