On Thu, Jan 13, 2011 at 10:03 PM, U.Nakamura <usa / garbagecollect.jp> wrote:
> Hello,
>
> In message "[ruby-core:34485] Re: Windows sockets and CRT fds"
>    on Jan.14,2011 13:35:42, <ghazel / gmail.com> wrote:
>> I understand it would have to be rewritten to change it, but why was
>> it written that way to begin with? Aside from the effort to change it,
>> is there anything lost or gained by switching?
>
> Q: why was it written that way to begin with?
> A: Sorry, I don't know.  I guess that the author might not want
>   to put many #ifdef-s into ruby core source.

win32.c and win32.h have a ton of ifdefs in them. What I'm proposing
would remove many of them, and not add any to the rest of Ruby code.
Who is the author of the _open_osfhandle code?

> Q: Aside from the effort to change it, is there anything lost or
>   gained by switching?
> A: Currently the programmer of an extension library doesn't need
>   to know about Windows if the extension library is not linked
>   to outer libraries.  After the switching, he must write two
>   code for Unix and Windows.  Of course, if the extension library
>   depends on outer libraries which treat Unix and Windows by
>   different way, his time will decrease because of omitting
>   the code for ruby's faked FD.

I'm not sure which parts you're saying need to be rewritten for Unix
and Windows. Currently there needs to be different code for Unix and
Windows, because a socket handle you might come across on Windows has
to be adapted to the sort of fd that ruby uses. After the hypothetical
switch to using regular Windows sockets in Ruby, you could take a
socket handle from anywhere and select on it in Ruby and have no
Windows specific code (except inside of Ruby). So, I only see it
reducing the amount of platform specific code (and bugs) in
extensions.

-Greg