On Tue, Dec 27, 2011 at 11:21 PM, Yukihiro Matsumoto <matz / ruby-lang.org> wrote:
> Hi,
>
> In message "Re: [ruby-core:41830] Re: Best way to separate implementationpecific code?"
>    岰   ծ > |
> |Hello,
> |
> |In message "[ruby-core:41828] Re: Best way to separate implementation specific code?"
> |  
> |> > KOSAKI, Usa, what do you think of the following?
> |
> |We need the agreements of common developpers who live on Unix.
> |So, you should ask to them, not me :)
> |
> |Matz, how do you think about such change of the source tree?
>
> I agree with replacing load_file_ok, but I am not sure such file
> restructuring needed.    >

Thank you matz for your response.

The proposed restructuring, at least for "windows" platform is
precisely to avoid complicated #ifdef that make really hard to modify.

Take as example file_expand_path:

316 LOC
15 comments
13 #ifdef
Mix of posix + cygwin + windows
1 goto

Pretty much the entire function can be replaced by Windows API.

I've a non-goto, WideChar and faster implementation of it in 170
lines, with lot of code that can be extracted and reused in other
functions.

As originally commented in [ruby-core:38940], the differences between
platforms are in some cases more complicated to maintain or improve
around lot of #ifdef and zero documentation around them.

If the idea of posix/file.c for rb_file_load_ok() is not good enough,
at least I ask we do win32/file.c, please.

-- 
Luis Lavena
AREA 17
-
Perfection in design is achieved not when there is nothing more to add,
but rather when there is nothing more to take away.
Antoine de Saint-Exupy