Skip to content
This repository was archived by the owner on Nov 25, 2025. It is now read-only.
This repository was archived by the owner on Nov 25, 2025. It is now read-only.

[0.3.0-draft] Consider making {tcp,udp}-socket.bind async #144

@dicej

Description

@dicej

Currently, these are synchronous functions, which makes sense given that they don't inherently involve I/O or blocking. However, they do perform a non-trivial operation that affects the state of the host system, and it's plausible that e.g. a browser polyfill might need to do some form of asynchronous operation to implement it. Additionally, a host might wish to restrict this operation to certain IP addresses or ranges, the validation of which might involve some form of blocking (e.g. to read configuration from a database).

Given that the component model will soon promote the async keyword from WIT-level sugar to part of the type system, with trapping behavior for non-async exports which try to block, we'll need to be more careful about declaring non-async functions in WIT. Therefore, the conservative choice when in doubt (i.e. if there's any chance the implementation might need to block) is to add async. An async function is always allowed to return without blocking, but a non-async function is never allowed to block prior to returning a result.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions