ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: "mame (Yusuke Endoh) via ruby-core" <ruby-core@ml.ruby-lang.org>
To: ruby-core@ml.ruby-lang.org
Cc: "mame (Yusuke Endoh)" <noreply@ruby-lang.org>
Subject: [ruby-core:120214] [Ruby master Feature#20884] reserve "Ruby" toplevel module for Ruby language
Date: Thu, 12 Dec 2024 11:33:57 +0000 (UTC)	[thread overview]
Message-ID: <redmine.journal-110976.20241212113357.11019@ruby-lang.org> (raw)
In-Reply-To: <redmine.issue-20884.20241112032119.11019@ruby-lang.org>

Issue #20884 has been updated by mame (Yusuke Endoh).


Discussed at the dev meeting.

@matz decided that Ruby 3.4 warns when ::Ruby is defined.

```
$ ./miniruby -we 'Ruby = 1'
-e:1: warning: ::Ruby is reserved for Ruby 3.5
```

If there are no major problems, it is likely that `module Ruby` will be predefined in Ruby 3.5.

However, note that what to put in the `::Ruby` module requires futher discussion.

* `Ruby::Backtrace::Location` was opposed by nobu.
* `AbstractSyntaxTree` is in RubyVM to make it explicitly implementation-dependent, so it will not be moved to `Ruby::`.
* No one sympathized with `Ruby.argv0` in the dev meeting. `Process.argv0` is good enough.
* #6648 is not agreed at the specification level, and I think it is unlikely to be a class method in `::Ruby`.

----------------------------------------
Feature #20884: reserve "Ruby" toplevel module for Ruby language
https://bugs.ruby-lang.org/issues/20884#change-110976

* Author: Dan0042 (Daniel DeLorme)
* Status: Open
----------------------------------------
`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` 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




-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/

  parent reply	other threads:[~2024-12-12 11:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-12  3:21 [ruby-core:119881] " Dan0042 (Daniel DeLorme) via ruby-core
2024-11-12  4:01 ` [ruby-core:119882] " ioquatix (Samuel Williams) via ruby-core
2024-11-12  6:15 ` [ruby-core:119885] " hsbt (Hiroshi SHIBATA) via ruby-core
2024-11-12 10:53 ` [ruby-core:119891] " Eregon (Benoit Daloze) via ruby-core
2024-11-12 13:46 ` [ruby-core:119894] " Dan0042 (Daniel DeLorme) via ruby-core
2024-12-12  7:18 ` [ruby-core:120200] " matz (Yukihiro Matsumoto) via ruby-core
2024-12-12 11:33 ` mame (Yusuke Endoh) via ruby-core [this message]
2024-12-25 12:08 ` [ruby-core:120405] " st0012 (Stan Lo) via ruby-core

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.journal-110976.20241212113357.11019@ruby-lang.org \
    --to=ruby-core@ml.ruby-lang.org \
    --cc=noreply@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).