Project

General

Profile

Feature #20884

Updated by Dan0042 (Daniel DeLorme) 6 days ago

`Ruby` would be a convenient namespace for many features of the Ruby language, in particular APIs related to the interpreter. 

 All these constants: 

	 RUBY_VERSION 
	 RUBY_RELEASE_DATE 
	 RUBY_PLATFORM 
	 RUBY_PATCHLEVEL 
	 RUBY_REVISION 
	 RUBY_COPYRIGHT 
	 RUBY_ENGINE 
	 RUBY_ENGINE_VERSION 
	 RUBY_DESCRIPTION 
	
 would have made a lot of sense as `Ruby::VERSION` `Ruby::Version` etc. 

 `Thread::Backtrace::Location` would have made a lot of sense as `Ruby::Backtrace::Location` 

 `RubyVM` is considered specific to CRuby; so `RubyVM::AbstractSyntaxTree` should be `Ruby::AbstractSyntaxTree` if it is meant to be present in other implementations. 

 In #6648 there's a bit of contention over where `ruby_args` should be. `RubyVM`, `RbConfig`, `Process` have all been proposed, but `Ruby` would be an excellent choice. 

 `Process.argv0` was added in Ruby 2.1 but the `Process` namespace is really about OS-level process control (fork, signals, euid, limits) while this argv0 is not (in `ps` it's neither value of COMMAND nor CMD) so it would have made sense as `Ruby.argv0` 

 The "ruby" gem name is reserved, so there's no conflict. https://rubygems.org/gems/ruby 

 All in all, "Ruby" is an appropriate namespace for many Ruby things. We don't want to break compatibility over this, but we could at least start small by reserving the namespace, and see how it grows from there. 

	 module Ruby 
	   VERSION = ::RUBY_VERSION 
	 end 

Back