so i’ve been away from rescript for a while, delving into a typescript project for work for some time. coming back, i’m having a hard time getting back into the proper mindset.
right now, i’m struggling with reasoning about this:
let’s say i have a TcpServer and TcpConn module. the TcpServer has a listen function that creates a tcp socket and starts accepting connections. for each connection, it creates a TcpConn (with its respective socket attached to it somehow in some opaque type). so far no real problems.
ok, let’s say i want to extend both of these to HttpServer and HttpConn effectively. the only ways i can come up with are either wrapping the TcpServer in the HttpServer module and effectively reimplementing everything or creating a functor (i haven’t fully wrapped my head around this).
how would you go about doing this? if some functionality is added to the TcpServer module, it should be “inherited” automatically into the HttpServer, as, effectively, an HttpServer is also a TcpServer.
thoughts?