From: Bill Kelly Date: 2008-07-25T17:21:02+09:00 Subject: [ruby-core:17961] Re: RUBY_ENGINE? From: "Ryan Davis" > 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] can I bring up the root issue? [2008/04/30 20:33:39] of wanting this constant [2008/04/30 20:33:43] yes [2008/04/30 20:33:46] do taht [2008/04/30 20:33:49] please [2008/04/30 20:33:56] 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] so they'd use this to figure out ruby/rbx/jruby whatever. [2008/04/30 20:34:06] that's already available [2008/04/30 20:34:16] not in 1.8 it's not. [2008/04/30 20:34:16] rbconfig [2008/04/30 20:34:22] thats the installed location [2008/04/30 20:34:25] not the current running one [2008/04/30 20:34:37] an great example of that is doing ../../blah/bin/ruby [2008/04/30 20:34:41] $0 ? [2008/04/30 20:34:45] $0 is the script [2008/04/30 20:34:50] Rubinius implements this [2008/04/30 20:35:00] evan: keep going [2008/04/30 20:35:00] by using getcwd() + argv[0] at start up [2008/04/30 20:35:02] argv[0] is not trustable [2008/04/30 20:35:08] to calculate the absolute path to the running binary // ... [2008/04/30 20:41:44] I don't think RUBY_ENGINE should be used for feature check // ... [2008/04/30 20:42:09] it must be used for something different // ... [2008/04/30 20:42:23] RUBY_ENGINE purpose: (1) search bin name, (2) check spec [2008/04/30 20:42:28] for example, choosing performance trick depends on implementation [2008/04/30 20:42:29] people will use RUBY_ENGINE for feature set either way [2008/04/30 20:42:29] any other reason? [2008/04/30 20:42:32] I guarantee it [2008/04/30 20:42:43] (3) show version [2008/04/30 20:43:04] 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] (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