Closed achille-roussel closed 1 year ago
Makes sense. It's been error prone having to check whether System
implementations also implement SocketsExtension
, and we don't have any use cases for System
implementations that do not also implement SocketsExtension
The separation of
SocketsExtension
fromSystem
causes a lot of checks from compile time to run time. Creating wrappers of theSystem
interface can easily miss that they have to implementSocketsExtension
if the underlying type does, resulting in unexpectedly disabling socket capabilities.Since the implementation of the
System
andSocketsExtension
interface is decoupled from the ABI, I would like to suggest that we merge the methods intoSystem
and remove theSocketsExtension
interface.For situations where a backend does not provide socket capabilities, I would suggest that we add a type which has the socket extension methods returning ENOSYS, that types can embed in order to easily declare that they don't support sockets. For example:
This is somewhat the inverse of the approach we have taken; instead of having extensions, implementations of
System
can declare the parts of the total interface that they don't support.Let me know what you think!