From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: poffice@blade.nagaokaut.ac.jp Delivered-To: poffice@blade.nagaokaut.ac.jp Received: from kankan.nagaokaut.ac.jp (kankan.nagaokaut.ac.jp [133.44.2.24]) by blade.nagaokaut.ac.jp (Postfix) with ESMTP id 328FC1960009 for ; Tue, 23 Jun 2015 06:00:19 +0900 (JST) Received: from funfun.nagaokaut.ac.jp (smtp.nagaokaut.ac.jp [133.44.2.201]) by kankan.nagaokaut.ac.jp (Postfix) with ESMTP id 66476B5D864 for ; Tue, 23 Jun 2015 06:24:01 +0900 (JST) Received: from funfun.nagaokaut.ac.jp (localhost.nagaokaut.ac.jp [127.0.0.1]) by funfun.nagaokaut.ac.jp (Postfix) with ESMTP id 057A897A83A for ; Tue, 23 Jun 2015 06:24:02 +0900 (JST) X-Virus-Scanned: amavisd-new at nagaokaut.ac.jp Authentication-Results: funfun.nagaokaut.ac.jp (amavisd-new); dkim=fail (1024-bit key) reason="fail (message has been altered)" header.d=sendgrid.me Received: from funfun.nagaokaut.ac.jp ([127.0.0.1]) by funfun.nagaokaut.ac.jp (funfun.nagaokaut.ac.jp [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id MbJj0pZjkm-0 for ; Tue, 23 Jun 2015 06:24:01 +0900 (JST) Received: from voscc.nagaokaut.ac.jp (voscc.nagaokaut.ac.jp [133.44.1.100]) by funfun.nagaokaut.ac.jp (Postfix) with ESMTP id 9394E97A826 for ; Tue, 23 Jun 2015 06:24:01 +0900 (JST) Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by voscc.nagaokaut.ac.jp (Postfix) with ESMTP id D741B952439 for ; Tue, 23 Jun 2015 06:23:58 +0900 (JST) Received: from [221.186.184.76] (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id DAA25120440; Tue, 23 Jun 2015 06:23:55 +0900 (JST) X-Original-To: ruby-core@ruby-lang.org Delivered-To: ruby-core@ruby-lang.org Received: from o10.shared.sendgrid.net (o10.shared.sendgrid.net [173.193.132.135]) by neon.ruby-lang.org (Postfix) with ESMTPS id 7EF54120411 for ; Tue, 23 Jun 2015 06:23:51 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sendgrid.me; h=from:to:references:subject:mime-version:content-type:content-transfer-encoding:list-id; s=smtpapi; bh=OnNG4v0sCVJau1yfY01v+IXjJH4=; b=RcudkaXN6HAJnXcRva /xEAYr/rCA9Og7W1z5Qda2YnoVlqrcF85NG5QmvsUZ0kj6oueiBOWmpwrJp02xVJ rS5gHfsOrMu0ZZrOJOs3+hH9z4+tsbLFeX/H2NA2cfHRgsNUkdGucI5dc+myTB3v g/CTfbnXMgYnqwssRlfaU28zg= Received: by filter0565p1mdw1.sendgrid.net with SMTP id filter0565p1mdw1.15991.55887CE115 2015-06-22 21:23:46.308014959 +0000 UTC Received: from herokuapp.com (ec2-107-22-97-169.compute-1.amazonaws.com [107.22.97.169]) by ismtpd-032 (SG) with ESMTP id 14e1d27d3fa.535.48a6ad for ; Mon, 22 Jun 2015 21:23:46 +0000 (UTC) Date: Mon, 22 Jun 2015 21:23:45 +0000 From: andrew.kozin@gmail.com To: ruby-core@ruby-lang.org Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Redmine-MailingListIntegration-Message-Ids: 44265 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 11294 X-Redmine-Issue-Author: nepalez X-Redmine-Sender: nepalez X-Mailer: Redmine X-Redmine-Host: bugs.ruby-lang.org X-Redmine-Site: Ruby Issue Tracking System X-Auto-Response-Suppress: All Auto-Submitted: auto-generated X-SG-EID: ync6xU2WACa70kv/Ymy4QrNMhiuLXJG8OTL2vJD1yS71x+82BXdMYevVxRKBpxTuBrYTc2WEMsWqva ABsbKuqVg9D1J75pCdCZnzMlc7J0SCITATLbb+lRmHA8rzBn1SkHENcT/ARUy6xaZDYw/AW8oWoIOV T6lR7S9XLEDQVfnCRWU9clVdkdSOphs11bUd X-SendGrid-Contentd-ID: {"test_id":"1435008227"} X-ML-Name: ruby-core X-Mail-Count: 69704 Subject: [ruby-core:69704] [Ruby trunk - Bug #11294] [Open] Possible bug in Object.const_get X-BeenThere: ruby-core@ruby-lang.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Ruby developers List-Id: Ruby developers List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" Issue #11294 has been reported by Andrew Kozin. ---------------------------------------- Bug #11294: Possible bug in Object.const_get https://bugs.ruby-lang.org/issues/11294 * Author: Andrew Kozin * Status: Open * Priority: Normal * Assignee: * ruby -v: 2.2 * Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN ---------------------------------------- ~~~ module Foo; end module Foo::Baz; end module Bar; end module Bar::Qux; end Object.const_get "Foo::Baz::Bar::Qux" # => Bar::Qux ~~~ Why on earth it is found at all? It seems pretty weird to me. The real problem arises later, when I add `Foo::Bar::Qux`: ~~~ module Foo::Bar; end module Foo::Bar::Qux; end ~~~ then the tree becomes as following: ~~~ Foo::Bar::Qux Foo::Baz Bar::Qux ~~~ But the result remains the same: ~~~ Object.const_get "Foo::Baz::Bar::Qux" # => Bar::Qux ~~~ Here I'd expect searching "Foo::Baz::Bar::Qux" to * either return nothing (this is less astonished, because there is no such constant), * or find the closest `Bar::Qux` to `Foo::Bar`, that is `Foo::Bar::Qux`, not the `Bar::Qux` I cannot even understand the logic that follows the `Object.const_get` in providing such a result. -- https://bugs.ruby-lang.org/