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 38B9C19A0281 for ; Sun, 23 Aug 2015 06:32:39 +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 2229CB5D86D for ; Sun, 23 Aug 2015 07:09:32 +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 D1C3997A832 for ; Sun, 23 Aug 2015 07:09:32 +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 NvXDUnSGcPKj for ; Sun, 23 Aug 2015 07:09:32 +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 5D47A97A82C for ; Sun, 23 Aug 2015 07:09:32 +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 62F52952408 for ; Sun, 23 Aug 2015 07:09:28 +0900 (JST) Received: from [221.186.184.76] (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 6BD1312045D; Sun, 23 Aug 2015 07:09:26 +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 1B60F120439 for ; Sun, 23 Aug 2015 07:09:22 +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=O8m+UbpYqAlqgJO7OxNpjsW3Gb4=; b=SJnscOGr57bQUO9at3 yZoOYpIYsrYciy4bfcy7I6zcpRp0pkuiqShEAb5mSiB/+hmhXTkvJzxzmDbyrRH+ SPXqEePMqOlgWf19q4tD4QfGlIAaz6MLQo3bvP8Sm2FHXzQ0cwx2f1vBHGvs/DT7 FTJ7+xwP45an1avseTjdp5mGk= Received: by filter0580p1mdw1.sendgrid.net with SMTP id filter0580p1mdw1.23378.55D8F30F6 2015-08-22 22:09:19.203884158 +0000 UTC Received: from herokuapp.com (ec2-54-162-89-106.compute-1.amazonaws.com [54.162.89.106]) by ismtpd0005p1iad1.sendgrid.net (SG) with ESMTP id zVv5v5skSrKnOjovRNn5-Q Sat, 22 Aug 2015 22:09:18.949 +0000 (UTC) Date: Sat, 22 Aug 2015 22:09:18 +0000 From: mail@yukinishijima.net To: ruby-core@ruby-lang.org Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Redmine-MailingListIntegration-Message-Ids: 45162 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 11477 X-Redmine-Issue-Author: yuki24 X-Redmine-Sender: yuki24 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/Ymy4QrNMhiuLXJG8OTL2vJD1yS7Frz1QZQCoVjSLr4cnp03efmv2QB/GeROzP7 +VaNX8Ia7SG2qIi4lJzgr9lhyjOSmSqzy3sEOssWqVYyKUb7Vy1f3rUAmHIHPLWTp6NhfULuuoYZQn L4RZ7+T5w3sqrh0KmGHrduLGYt8l72tPQbZZ X-SendGrid-Contentd-ID: {"test_id":"1440281360"} X-ML-Name: ruby-core X-Mail-Count: 70550 Subject: [ruby-core:70550] [Ruby trunk - Feature #11477] NameError#qualified_name 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 #11477 has been updated by Yuki Nishijima. That actually makes more sense and is what we talked about at the last Ruby= developers meeting. According to Nobu it requires a lot of work, though. B= ut in terms of the interface, I'm =F0=9F=91=8D on `NameError#receiver` retu= rning the receiving module in a "uninitialized constant" NameError. ---------------------------------------- Feature #11477: NameError#qualified_name https://bugs.ruby-lang.org/issues/11477#change-53959 * Author: Yuki Nishijima * Status: Open * Priority: Normal * Assignee:=20 ---------------------------------------- Hi, This is a followup issue to #11252. I'd like to add a method that basically= does the same thing as [NameError#missing_name](https://github.com/rails/r= ails/blob/ebe73abea0ae02094ddc28f8fd60ae92373b6113/activesupport/lib/active= _support/core_ext/name_error.rb#L2-L14). This will allow gems like Rails an= d did_you_mean to get a qualified name without parsing an error message. ```ruby begin HelloWorld rescue NameError =3D> e error.name # =3D> :HelloWorld error.qualified_name # =3D> :HelloWorld end begin String::DoesntExist rescue NameError =3D> e error.name # =3D> :DoesntExist error.qualified_name # =3D> :"String::DoesntExist" end ``` I'm not actually sure what it should return when the module/class is an ano= nymous module/class, but one thing we can do is just use the result of `#to= _s`: ```ruby m =3D Module.new begin m::DoesntExist rescue NameError =3D> e error.name # =3D> :DoesntExist error.qualified_name # =3D> :"#::DoesntExist" end ``` I'm open to suggestions. Let me know what you think. Yuki --=20 https://bugs.ruby-lang.org/