From: manga.osyo@gmail•com
To: ruby-dev@ruby-lang.org
Subject: [ruby-dev:50737] [Ruby trunk Bug#15488] const_defined?("File::NULL") の挙動
Date: Sun, 30 Dec 2018 04:28:01 +0000 (UTC) [thread overview]
Message-ID: <redmine.journal-76001.20181230042759.c9493ca3856b2d11@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-15488.20181230040701@ruby-lang.org
Issue #15488 has been updated by osyo (manga osyo).
`File.const_defined?` だと `true` になるようですね。
```ruby
p Object.const_get("File::NULL") #=> "/dev/null"
p Object.const_defined?("File::NULL") #=> false
p File.const_get("NULL") #=> "/dev/null"
p File.const_defined?("NULL") #=> true
```
----------------------------------------
Bug #15488: const_defined?("File::NULL") の挙動
https://bugs.ruby-lang.org/issues/15488#change-76001
* Author: shuujii (Shuji KOBAYASHI)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
* ruby -v: ruby 2.6.0p0 (2018-12-25 revision 66547) [x86_64-linux]
* Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
`const_get` と `const_defined?` について、例えば `Math::PI` では以下のようになり
どちらも期待通りの結果になります。
~~~ruby
p Object.const_get("Math::PI") #=> 3.141592653589793
p Object.const_defined?("Math::PI") #=> true
~~~
一方、`File::NULL` の場合は以下のように `const_get` で値が取得できるのに
`const_defined?` が `false` になります。
~~~ruby
p Object.const_get("File::NULL") #=> "/dev/null"
p Object.const_defined?("File::NULL") #=> false
~~~
これは意図的でしょうか。
--
https://bugs.ruby-lang.org/
next prev parent reply other threads:[~2018-12-30 4:28 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <redmine.issue-15488.20181230040701@ruby-lang.org>
2018-12-30 4:07 ` [ruby-dev:50736] [Ruby trunk Bug#15488] const_defined?("File::NULL") の挙動 shuujii
2018-12-30 4:28 ` manga.osyo [this message]
2018-12-30 5:06 ` [ruby-dev:50738] " manga.osyo
2018-12-30 6:09 ` [ruby-dev:50739] " shuujii
2018-12-30 8:18 ` [ruby-dev:50740] " manga.osyo
2019-01-29 5:00 ` [ruby-dev:50775] " naruse
2019-03-13 0:03 ` [ruby-dev:50782] " nagachika00
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-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.ruby-lang.org/en/community/mailing-lists/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=redmine.journal-76001.20181230042759.c9493ca3856b2d11@ruby-lang.org \
--to=ruby-dev@ruby-lang.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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 read-only IMAP folder(s) and NNTP newsgroup(s).