Are there any examples of how to declare a class in wit?
Looks like resource is what I am looking for?
Yes, a resource, if you want to pass around references to it. Though be aware that wit-bindgen doesn't support resources yet.
If you want to pass it by value instead of by reference, you can use a record
.
Dan Gohman said:
Yes, a resource, if you want to pass around references to it. Though be aware that wit-bindgen doesn't support resources yet.
Thanks - I worked that out, looks like it was removed to be reimplemented once the spec has settled?
Dan Gohman said:
If you want to pass it by value instead of by reference, you can use a
record
.
I tried record
but it doesn't support functions?
you can't serialize code generally, "by value" means you can only copy the data of the class, but not its methods, you would need to reimplement them on both host and guest side separately
Yes; instead of methods, you can have functions that take records as arguments.
Gordon Smith said:
Thanks - I worked that out, looks like it was removed to be reimplemented once the spec has settled?
Exactly.
Last updated: Nov 22 2024 at 17:03 UTC