On Thu, Jan 21, 2010 at 9:57 PM, Hongli Lai <hongli / plan99.net> wrote: > [...] > >> * Provide another mechanism for querying specific features, like >> Platform.support? :fork > > How is this better than calling the method and catching NotImplementedError? Your > check method, although returning a boolean, still calls the method under the hood. > This makes #support? an expensive call which is something I wanted to avoid with > #fork_supported?. > I might be able to answer that. While experimenting with Rubinius and MinGW, I've created a C library that collected at compile time the related information of the platform, and exposed it as CAPI extension. That can, using extconf, #define, #ifdef etc the functionality exposed by the platform you're running on. In the case of JRuby, that Platform module can evaluate the underlying OS capabilities and return you true/false without the need of triggering NotImplementedError At the end, I believe both fork_supported? and Platform.support? :fork aim at the same, but the later can serve as API for other functionality, like symlink, hardlinks, etc. Just a thought. PS: I propose we paint the bike shed red. -- 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ñÓy