haskell / network

Low-level networking interface
http://hackage.haskell.org/package/network
Other
327 stars 188 forks source link

Clarify the pseudo-deprecation of send/recv functions #183

Closed lspitzner closed 8 years ago

lspitzner commented 9 years ago

Do not use the send and recv functions defined in this module in new code, as they incorrectly represent binary data as a Unicode string. As a result, these functions are inefficient and may lead to bugs in the program. Instead use the send and recv functions defined in the ByteString module.

All the Buf versions don't use any Strings, e.g. sendBuf :: Socket -> Ptr Word8 -> Int -> IO Int. So i guess the deprecation does not affect them. Either way, the warning should be made more clear (even if there is a higher-level interface planned for some point to replace all send/recv functions).

kazu-yamamoto commented 9 years ago

Right. Indeed, Newtwork.Socket.ByteString imports these functions.

I made a patch to fix this. Please check the patch above.

lspitzner commented 9 years ago

Looks good, thanks! (I'd maybe change the doc "s/in this module/in this section/" to make it clear, but i guess this is sufficient). Network.Socket.ByteString does not export any of these function though, right?

kazu-yamamoto commented 8 years ago

Sorry for the delay.

Looks good, thanks! (I'd maybe change the doc "s/in this module/in this section/" to make it clear, but i guess this is sufficient).

Fixed.

Network.Socket.ByteString does not export any of these function though, right?

I think you are right.

Thank you for your review. These patches have been merged.

lspitzner commented 8 years ago

Great!