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 DC7D91960009 for ; Tue, 23 Jun 2015 07:58:07 +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 19EB3B5D868 for ; Tue, 23 Jun 2015 08:21:51 +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 EA93F97A838 for ; Tue, 23 Jun 2015 08:21:51 +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 uWPTb5S2jgA0 for ; Tue, 23 Jun 2015 08:21:51 +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 88B9197A82C for ; Tue, 23 Jun 2015 08:21:51 +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 8ACAB95243E for ; Tue, 23 Jun 2015 08:21:50 +0900 (JST) Received: from [221.186.184.76] (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 7FE93120442; Tue, 23 Jun 2015 08:21:48 +0900 (JST) X-Original-To: ruby-core@ruby-lang.org Delivered-To: ruby-core@ruby-lang.org Received: from o2.heroku.sendgrid.net (o2.heroku.sendgrid.net [67.228.50.55]) by neon.ruby-lang.org (Postfix) with ESMTPS id 8274A12041F for ; Tue, 23 Jun 2015 08:21:44 +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=pOD0LhnIzLLwBngExkCffk4DkJs=; b=T6tu9CKXbba/JXvccC vXpBEWrnZrGSF8Rjw1G4UevC/7ALgsWr9xkIxB2H7kAc3NuHbwIxX43xPWFx92LE LSmQ3PnBsL8tZHbKAsjp2VJvCEy2XTcmMQqGUfXVMm658eTvP/ovP4k1Ndg0/zSs 5gfLf+vmTXXmrcLYXe0ylwoWk= Received: by filter0644p1mdw1.sendgrid.net with SMTP id filter0644p1mdw1.19971.558898828 2015-06-22 23:21:39.168144634 +0000 UTC Received: from herokuapp.com (ec2-54-205-61-174.compute-1.amazonaws.com [54.205.61.174]) by ismtpd-021 (SG) with ESMTP id 14e1d93bde6.85f.df3b9 for ; Mon, 22 Jun 2015 23:21:38 +0000 (UTC) Date: Mon, 22 Jun 2015 23:21:34 +0000 From: nobu@ruby-lang.org 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: 44268 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 11294 X-Redmine-Issue-Author: nepalez X-Redmine-Sender: nobu 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/Ymy4QrNMhiuLXJG8OTL2vJD1yS5P9iqBw4KPiAwlK2uwQnHK+qalLcpjZfRN/U ejVPKBsX6XqnQN+vax1Drdgrg13G0+1m2Y5erYzCbyprTEfZFZB4TDkP1mtuN0lAiwYCWe9ASZNqo7 LzzH8SCKIc5djak= X-ML-Name: ruby-core X-Mail-Count: 69707 Subject: [ruby-core:69707] [Ruby trunk - Bug #11294] [Rejected] 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 updated by Nobuyoshi Nakada. Description updated Status changed from Open to Rejected Toplevel constants are defined under `Object` context, which are inherited by every contexts. Your results are same as: ~~~ruby module Foo::Baz; p Bar::Qux; end #=> Bar::Qux ~~~ > * or find the closest `Bar::Qux` to `Foo::Bar`, that is `Foo::Bar::Qux`, not the `Bar::Qux` It's *not* close. And `Foo::Baz::Bar` is different from `Foo::Bar`. ---------------------------------------- Bug #11294: Possible bug in Object.const_get https://bugs.ruby-lang.org/issues/11294#change-53084 * Author: Andrew Kozin * Status: Rejected * Priority: Normal * Assignee: * ruby -v: 2.2 * Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN ---------------------------------------- ~~~ruby 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`: ~~~ruby module Foo::Bar; end module Foo::Bar::Qux; end ~~~ then the tree becomes as following: ~~~ruby Foo::Bar::Qux Foo::Baz Bar::Qux ~~~ But the result remains the same: ~~~ruby 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/