Stream: git-wasmtime

Topic: wasmtime / PR #5065 unsplat component::Linker::func_wrap ...


view this post on Zulip Wasmtime GitHub notifications bot (Oct 17 2022 at 23:03):

pchickey opened PR #5065 from pch/unsplat_component_func_wrap to main:

retire the IntoComponentFunc trait, directly accept a closure in the type signature of Linker::func_wrap.

This means "unsplatting" the arguments of the closure:

We find that this makes the Linker::func_wrap type signature much easier to read. The IntoComponentFunc abstraction was adding a lot of weight to "splat" a set of arguments from a tuple of types into individual arguments to the closure. Additionally, making the StoreContextMut argument optional, or the Result<return> optional, wasn't required.

This interface does end up being a little bit awkward for human authors, but we feel this is outweighed by making the type signature of func_wrap much nicer to read, and also mitigated by the fact that most reasonable people will be using wit-bindgen to write these func_wraps on their behalf.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 17 2022 at 23:04):

pchickey requested alexcrichton for a review on PR #5065.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 17 2022 at 23:04):

pchickey edited PR #5065 from pch/unsplat_component_func_wrap to main:

retire the IntoComponentFunc trait, directly accept a closure in the type signature of component::Linker::func_wrap.

This means "unsplatting" the arguments of the closure:

We find that this makes the Linker::func_wrap type signature much easier to read. The IntoComponentFunc abstraction was adding a lot of weight to "splat" a set of arguments from a tuple of types into individual arguments to the closure. Additionally, making the StoreContextMut argument optional, or the Result<return> optional, wasn't required.

This interface does end up being a little bit awkward for human authors, but we feel this is outweighed by making the type signature of func_wrap much nicer to read, and also mitigated by the fact that most reasonable people will be using wit-bindgen to write these func_wraps on their behalf.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 17 2022 at 23:48):

pchickey updated PR #5065 from pch/unsplat_component_func_wrap to main.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 18 2022 at 14:24):

alexcrichton submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 18 2022 at 14:24):

alexcrichton merged PR #5065.


Last updated: Oct 23 2024 at 20:03 UTC