Stream: wit-bindgen

Topic: ✔ options without types?


view this post on Zulip Scott Waye (Jan 15 2024 at 00:13):

Is this valid wit

oint-arg: func(x: option<s32>);

I.e. an option without a type ?

view this post on Zulip Scott Waye (Jan 15 2024 at 00:15):

If so, for the codgen, would it be typical to create an implicit type for it?

view this post on Zulip Scott Waye (Jan 15 2024 at 00:16):

I think it is, at least the c codegen does it

typedef struct {
  bool is_some;
  int32_t val;
} my_world_option_s32_t;

view this post on Zulip Scott Waye (Jan 15 2024 at 03:28):

I guess I'm just curious why the c and go codegen have logic for anonymous types but not the others.

view this post on Zulip Notification Bot (Jan 15 2024 at 03:29):

A message was moved here from #wit-bindgen > Relation between imported and exported types by Scott Waye.

view this post on Zulip Slava Kuzmich (Jan 15 2024 at 07:02):

option is one of the built-in WIT types and can be used without attaching a name. As for bindings for statically typed languages:

view this post on Zulip Notification Bot (Jan 15 2024 at 12:38):

Scott Waye has marked this topic as resolved.


Last updated: Oct 23 2024 at 20:03 UTC