Goop 1.4.0
Goop 1.4.0
Goop 1.4.0 adds Go method and field imports. Goop code can now call selectors
on opaque imported Go values without introducing a one-off @[go] adapter.
Highlights
- Method imports: declare
val (x : T).M : A -> Bin animport go
block and call it withx.M arg(orT.M x arg). - Field imports: a non-arrow selector type, such as
val (a : Attr).Key : string, lowers to a Go field read. - Go-shaped values: callbacks,
go_sliceindexing (xs.(i)),any_of,
andspreadwork with imported methods and variadic APIs. - Examples:
go_method_calls.goop
importsbytes.Buffer.String; the native
slog.Handlerexample
now imports and callsslog.NewandLogger.Info.
Verification
goop check docs/examples/go_method_calls.goopgoop check docs/examples/go_implements_stringer.goopgoop check docs/examples/go_implements_slog_handler.goopgoop test tests/- Verify generated Go contains direct selector calls such as
b.String()and
accepts the emittedslog.Handlerassertion.