Skip to content

fdSocket should not be deprecated #418

@bitc

Description

@bitc

The docs for fdSocket explain why it can be dangerous, and the docs recommend using withFdSocket instead.

This is a great suggestion, but sometimes the structure of your code does not allow you to use a "with" style. (In my program, I need to pass the socket fd to some C code that will continue to write to it after my Haskell code block returns)

It is my understanding that it is possible to use fdSocket safely: you simply must make sure not to close the Socket while you are still using the fd. (And to make sure that you hang on to the Socket somewhere so that the GC doesn't get it -- but you should be holding on to it anyway so that you can close it when you are finished with it)

So I request that the fdSocket function not be deprecated. I agree that the should have a warning, but the function should continue to be available and supported in future versions of this package.

Thank you

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions