Hi Bill,

Ah, I forgot about that discussion...

Maybe I'm missing something here, but I always thought that this kind
of functionality (detecting the path to the implementation that
currently runs the code) *is* already available via 'rbconfig' lib:

RUBY = File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name'])

Works fine with MRI 1.8 and 1.9, JRuby, Rubinius.

thanks,
  --Vladimir

On Fri, Jul 25, 2008 at 10:21 AM, Bill Kelly <billk / cts.com> wrote:
>
> From: "Ryan Davis" <ryand-ruby / zenspider.com>
>>
>> On Jul 24, 2008, at 19:35 , Tanaka Akira wrote:
>>>
>>> What the usage of RUBY_ENGINE?
>>>
>>> I heard it is used to know command name at the IRC meeting.
>>> I think it is not good idea.
>>
>> not command name, but ruby "flavor": (mri) ruby, rubinius, jruby, etc.
>
> From: http://ruby-design.pbwiki.com/f/ruby-core-20080430.txt
>
> [2008/04/30 20:21:59] @ headius set topic
> http://ruby-design.pbwiki.com/Design20080430 - RUBY_ENGINE or similar
> constant to indicate implementation
> // ...
> [2008/04/30 20:33:31] <evan> can I bring up the root issue?
> [2008/04/30 20:33:39] <evan> of wanting this constant
> [2008/04/30 20:33:43] <headius> yes
> [2008/04/30 20:33:46] <headius> do taht
> [2008/04/30 20:33:49] <enebo> please
> [2008/04/30 20:33:56] <evan> 99.9% of the time, it's because someone needs
> to know the name of the ruby command
> thaht was issued to run the current program
> [2008/04/30 20:34:06] <evan> so they'd use this to figure out ruby/rbx/jruby
> whatever.
> [2008/04/30 20:34:06] <headius> that's already available
> [2008/04/30 20:34:16] <evan> not in 1.8 it's not.
> [2008/04/30 20:34:16] <akr> rbconfig
> [2008/04/30 20:34:22] <evan> thats the installed location
> [2008/04/30 20:34:25] <evan> not the current running one
> [2008/04/30 20:34:37] <evan> an great example of that is doing
> ../../blah/bin/ruby
> [2008/04/30 20:34:41] <lrz> $0 ?
> [2008/04/30 20:34:45] <evan> $0 is the script
> [2008/04/30 20:34:50] <evan> Rubinius implements this
> [2008/04/30 20:35:00] <matz_> evan: keep going
> [2008/04/30 20:35:00] <evan> by using getcwd() + argv[0] at start up
> [2008/04/30 20:35:02] <akr> argv[0] is not trustable
> [2008/04/30 20:35:08] <evan> to calculate the absolute path to the running
> binary
>
> // ...
>
> [2008/04/30 20:41:44] <matz_> I don't think RUBY_ENGINE should be used for
> feature check
> // ...
> [2008/04/30 20:42:09] <matz_> it must be used for something different
> // ...
> [2008/04/30 20:42:23] <ko1_> RUBY_ENGINE purpose: (1) search bin name, (2)
> check spec
> [2008/04/30 20:42:28] <matz_> for example, choosing performance trick
> depends on implementation
> [2008/04/30 20:42:29] <headius> people will use RUBY_ENGINE for feature set
> either way
> [2008/04/30 20:42:29] <ko1_> any other reason?
> [2008/04/30 20:42:32] <headius> I guarantee it
> [2008/04/30 20:42:43] <ko1_> (3) show version
> [2008/04/30 20:43:04] <MenTaLguY> I think there needs to be a more explicit
> way to determine the command name
> the current Ruby interpreter was started with
> [2008/04/30 20:43:06] <unak> (4) installing gems
> // ...
>
>
> Seems people had a number of use cases in mind, indeed including
> determining the name of the actual ruby binary name.
>
>
> Regards,
>
> Bill
>
>
>
>