-
Notifications
You must be signed in to change notification settings - Fork 252
Open
Labels
gen-goRelated to the Go code generatorRelated to the Go code generator
Description
I'm wondering if the Option and Result handling in the Go portion would be easier to use with some changes to the API. Here's one possibility:
import (
wit "wit_component/wit_types"
)
optionExample := wit.Some("foo")
resultExample := wit.Ok[int, error](0)
// Current implementation
if optionExample.Tag() == wit.OptionSome {
// ...
}
if resultExample.Tag() == wit.ResultErr {
// ...
}
// Suggested implementation
if optionExample.IsNone() {
// ...
}
if resultExample.IsOk() {
// ...
}Metadata
Metadata
Assignees
Labels
gen-goRelated to the Go code generatorRelated to the Go code generator