Closed sunfishcode closed 3 years ago
That would be a nice addition!
In wasi-crypto
, a custom Option
type is also used everywhere, which leads to non-idiomatic generated code in languages supporting optional types.
The code here looks fine to me, but I would hesitate because I'm not sure whether we want to continue to enhance the current ABI of WASI since it makes it more complicated to support in a future with support for a new ABI. I've been working on an abi-next
branch locally which also has support for option
, and I definitely agree it would be nice to support!
Do you think it would be better for me to try to land by "abi next" work and get option
supported only there? Or do you think that it would be best to stick with this extension to the current ABI?
Ah, cool. I'm ok waiting for the new ABI; this was just for some prototyping I was doing.
Ok! I'll work on cleaning that up for a PR this week.
Ok I posted https://github.com/WebAssembly/WASI/pull/422 which has option
in it as well
I was mocking up a witx description for #322 and had a use for an
option
type. Of course, I could also just emit a variant manually, or reuseexpected
by omitting the error type, butoption
better conveys the sense that thenone
case doesn't necessarily represent an error.