On Sat, Jul 26, 2008 at 5:09 AM, Tanaka Akira <akr / fsij.org> wrote:
> In article <3454c9680807250054i70db563duf44b42d92ba41bfb / mail.gmail.com>,
>  "Vladimir Sizikov" <vsizikov / gmail.com> writes:
>
>> 1. RubyGems uses it to invoke #{RUBY_ENGINE}.rb file with
>> customizations, specific for particular implementation
>
> I'm not sure what the customizations to be done.
>

One example is the gem stub files generated by RubyGems that need to
be changed to reflect the name of the executable for jRuby (jruby.bat)
at least in Windows.

I've seen and dealt with many regexp that just evaluate /java/ for
RUBY_PLATFORM and I need to perform customization for it (like using a
.jar file instead of a C extension).

>> 2. Different implementations have different specifics, like JRuby can
>> 'require' a JAR file and need different activerecord drivers, etc.
>> There are also some JRuby-specific libraries that only make sens for
>> JRuby, and the whole Java Integration layer. So, folks need to figure
>> out when they run with JRuby and when they not.
>
> Why don't just try "some feature"?
>
>...
>
> is much better becuase it works well with other engines if
> it provide zlib.

This is for gems or packages that are both compatible (or intend to
be) with the different implementations. Is not about the rescue of a
missing feature.

One example is jruby on Windows cannot perform a series of socket
related functions, while on posix platform it can. So limit your code
to only RUBY_PLATFORM =~ /java/ doesn't work.

So under jRuby there is no way to know the underlying OS because they
rely on RUBY_PLATFORM to make it looks like java. The same will happen
with Rubinius when it works on Windows or IronRuby when it build in
Mono.

Right now, besides query RUBY_PLATFORM, you also need:

defined?(JRUBY_VERSION) or defined?(Rubinius) to deal with specfic
code for those cases... (dunno about IronRuby).

What about an unified way that doesn't pollute the already complicated
RUBY_PLATFORM?

-- 
Luis Lavena
AREA 17
-
Human beings, who are almost unique in having the ability to learn from
the experience of others, are also remarkable for their apparent
disinclination to do so.
Douglas Adams