WebAssembly / wasi-io

I/O Types proposal for WASI
Other
144 stars 20 forks source link

what's the purpose of `pollable.block`? #60

Closed yamt closed 11 months ago

yamt commented 11 months ago

pollable.block is documented as:

      /// This function is equivalent to calling `poll.poll` on a list
      /// containing only this pollable.

what's the point to have this redundant method? what's wrong with always using poll.poll?

pchickey commented 11 months ago

We provide convenience methods on the streams resources for performing blocking reads, writes, and flushes. This is another convenience method. We found ourselves adding this method pretty frequently in library code, so its nice to have the bindings generate it for us.

Previously, this was a standalone function called poll-one. After adopting resources, it made sense to make it a method. We chose the name block to not confuse with poll.

sunfishcode commented 11 months ago

The question here seems answered; please reopen or file new issues if there are any further questions!