From: Luis Lavena Date: 2011-12-28T11:36:53+09:00 Subject: [ruby-core:41832] Re: Best way to separate implementation specific code? On Tue, Dec 27, 2011 at 11:21 PM, Yukihiro Matsumoto wrote: > Hi, > > In message "Re: [ruby-core:41830] Re: Best way to separate implementation specific code?" > � �on Wed, 28 Dec 2011 11:11:58 +0900, "U.Nakamura" writes: > | > |Hello, > | > |In message "[ruby-core:41828] Re: Best way to separate implementation specific code?" > | � �on Dec.28,2011 00:09:28, wrote: > |> > 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. �It seems simple ifdef would be enough. > 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-Exup�ry