skypjack / uvw

Header-only, event based, tiny and easy to use libuv wrapper in modern C++ - now available as also shared/static library!
MIT License
1.84k stars 209 forks source link

TCPHandle custom. #243

Closed cmachacacordova closed 3 years ago

cmachacacordova commented 3 years ago

Hello. First of all thanks for the library. And second, can we remove the "final" operator of the TCPHandle class and have the loop.resource () method accept the custon class of TCPHandle?

Example: class TCPHandleExtended : public uvw::TCPHandle { }; //other code.... auto loop = uvw::Loop::getDefault(); auto tcpExtended = loop->resource<TCPHandleExtended>(); //other code....

Mi ingles no es bueno. Thanks!

skypjack commented 3 years ago

🤔 Can I ask you what would be the purpose of this? I mean, why do you want to extend the tcp handle?

cmachacacordova commented 3 years ago

It is to create classes like Server or Client. It's an idea. With libuv I created my classes extending from uv_tcp_t and thus start the class together with the necessary handle

skypjack commented 3 years ago

I'd rather suggest to use a data member for that. There is nothing wrong in removing the final, though conceptually a server uses a handle while it is not a handle.

stefanofiorentino commented 3 years ago

As I prefer composition over inheritance in this kind of situation, I like the final keyword on every handle.

Il giorno dom 16 mag 2021 alle 11:55 Michele Caini @.***> ha scritto:

I'd rather suggest to use a data member for that. There is nothing wrong in removing the final, though conceptually a server uses a handle while it is not a handle.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/skypjack/uvw/issues/243#issuecomment-841794286, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABPVRMXRKOXKAP7J32IB46TTN6JB7ANCNFSM446JPGPA .

-- @fiorentinoIng https://twitter.com/fiorentinoing - @.***

cmachacacordova commented 3 years ago

Ok, I close the ticket.