[Issue 23793] New: std.stdio.openNetwork should be refactored and moved to a different place
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Mar 18 19:54:16 UTC 2023
https://issues.dlang.org/show_bug.cgi?id=23793
Issue ID: 23793
Summary: std.stdio.openNetwork should be refactored and moved
to a different place
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: enhancement
Priority: P1
Component: phobos
Assignee: nobody at puremagic.com
Reporter: witold.baryluk+d at gmail.com
std.stdio.openNetwork should be moved to different place
While I think it is useful in principle, it should not be in std.stdio.
It causes any program importing std.stdio, to link to network stack including
functions like gethostname, which with most libc will cause issues with static
linking.
It also slows down all the std.stdio imports for everybody, while maybe 0.001%
of people actually us that function.
A much better approach would be to have a function that accepts a TCP socket,
and converts it to std.stdio.File.
Such function should be in own module, like std.socket.file, or something like
this.
This way user is in a control of all connection settings, and function does
just one thing.
Right now openNetwork is too hermetic and does multiple things.
--
More information about the Digitalmars-d-bugs
mailing list