hare

The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit 8756875faf241bb52dd9614e4e685d0d6659c7d5
parent ba9ca5271ee6e4d2cd77bca58f72c937aea6e56c
Author: Eyal Sawady <ecs@d2evs.net>
Date:   Thu, 13 Jan 2022 12:45:00 +0000

net: drop forward references workaround

Signed-off-by: Eyal Sawady <ecs@d2evs.net>

Diffstat:
Mnet/errors.ha | 15---------------
Mnet/listener.ha | 12++++++++++++
2 files changed, 12 insertions(+), 15 deletions(-)

diff --git a/net/errors.ha b/net/errors.ha @@ -16,18 +16,3 @@ export fn strerror(err: error) const str = { return errors::strerror(err); }; }; - -// TODO: listener should not be here, working around bug in harec forward -// references - -// A listener binds a socket and listens for incoming traffic for some -// unspecified protocol. This is generally most useful for providing an -// abstraction between a TCP socket and Unix socket (or any other stream -// oriented protocol), where the implementation which accepts and processes -// connections is not aware of the underlying transport. Most users will not -// need to use this interface directly, preferring functions such as -// [[net::tcp::accept]]. -export type listener = struct { - accept: nullable *fn(l: *listener) (io::file | error), - shutdown: nullable *fn(l: *listener) void, -}; diff --git a/net/listener.ha b/net/listener.ha @@ -1,6 +1,18 @@ use errors; use io; +// A listener binds a socket and listens for incoming traffic for some +// unspecified protocol. This is generally most useful for providing an +// abstraction between a TCP socket and Unix socket (or any other stream +// oriented protocol), where the implementation which accepts and processes +// connections is not aware of the underlying transport. Most users will not +// need to use this interface directly, preferring functions such as +// [[net::tcp::accept]]. +export type listener = struct { + accept: nullable *fn(l: *listener) (io::file | error), + shutdown: nullable *fn(l: *listener) void, +}; + // Accepts the next connection from a listener. Blocks until a new connection is // available. export fn accept(l: *listener) (io::file | error) = {