ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:70544] [Ruby trunk - Feature #11477] [Open] NameError#qualified_name
       [not found] <redmine.issue-11477.20150822085912@ruby-lang.org>
@ 2015-08-22  8:59 ` mail
  2015-08-22 14:21 ` [ruby-core:70546] [Ruby trunk - Feature #11477] NameError#qualified_name eregontp
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 5+ messages in thread
From: mail @ 2015-08-22  8:59 UTC (permalink / raw
  To: ruby-core

Issue #11477 has been reported by Yuki Nishijima.

----------------------------------------
Feature #11477: NameError#qualified_name
https://bugs.ruby-lang.org/issues/11477

* Author: Yuki Nishijima
* Status: Open
* Priority: Normal
* Assignee: 
----------------------------------------
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/rails/blob/ebe73abea0ae02094ddc28f8fd60ae92373b6113/activesupport/lib/active_support/core_ext/name_error.rb#L2-L14). This will allow gems like Rails and did_you_mean to get a qualified name without parsing an error message.

```ruby
begin
  HelloWorld
rescue NameError => e
  error.name           # => :HelloWorld
  error.qualified_name # => :HelloWorld
end

begin
  String::DoesntExist
rescue NameError => e
  error.name           # => :DoesntExist
  error.qualified_name # => :"String::DoesntExist"
end
```

I'm not actually sure what it should return when the module/class is an anonymous module/class, but one thing we can do is just use the result of `#to_s`:

```ruby
m = Module.new

begin
  m::DoesntExist
rescue NameError => e
  error.name           # => :DoesntExist
  error.qualified_name # => :"#<Module:0x0000000260c2f8>::DoesntExist"
end
```

I'm open to suggestions. Let me know what you think.

Yuki



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [ruby-core:70546] [Ruby trunk - Feature #11477] NameError#qualified_name
       [not found] <redmine.issue-11477.20150822085912@ruby-lang.org>
  2015-08-22  8:59 ` [ruby-core:70544] [Ruby trunk - Feature #11477] [Open] NameError#qualified_name mail
@ 2015-08-22 14:21 ` eregontp
  2015-08-22 15:05 ` [ruby-core:70548] " eregontp
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 5+ messages in thread
From: eregontp @ 2015-08-22 14:21 UTC (permalink / raw
  To: ruby-core

Issue #11477 has been updated by Benoit Daloze.


Is NameError#receiver (#10881) not enough and better/easier to use?

----------------------------------------
Feature #11477: NameError#qualified_name
https://bugs.ruby-lang.org/issues/11477#change-53953

* Author: Yuki Nishijima
* Status: Open
* Priority: Normal
* Assignee: 
----------------------------------------
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/rails/blob/ebe73abea0ae02094ddc28f8fd60ae92373b6113/activesupport/lib/active_support/core_ext/name_error.rb#L2-L14). This will allow gems like Rails and did_you_mean to get a qualified name without parsing an error message.

```ruby
begin
  HelloWorld
rescue NameError => e
  error.name           # => :HelloWorld
  error.qualified_name # => :HelloWorld
end

begin
  String::DoesntExist
rescue NameError => e
  error.name           # => :DoesntExist
  error.qualified_name # => :"String::DoesntExist"
end
```

I'm not actually sure what it should return when the module/class is an anonymous module/class, but one thing we can do is just use the result of `#to_s`:

```ruby
m = Module.new

begin
  m::DoesntExist
rescue NameError => e
  error.name           # => :DoesntExist
  error.qualified_name # => :"#<Module:0x0000000260c2f8>::DoesntExist"
end
```

I'm open to suggestions. Let me know what you think.

Yuki



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [ruby-core:70548] [Ruby trunk - Feature #11477] NameError#qualified_name
       [not found] <redmine.issue-11477.20150822085912@ruby-lang.org>
  2015-08-22  8:59 ` [ruby-core:70544] [Ruby trunk - Feature #11477] [Open] NameError#qualified_name mail
  2015-08-22 14:21 ` [ruby-core:70546] [Ruby trunk - Feature #11477] NameError#qualified_name eregontp
@ 2015-08-22 15:05 ` eregontp
  2015-08-22 22:09 ` [ruby-core:70550] " mail
  2015-11-15 11:17 ` [ruby-core:71494] [Ruby trunk - Feature #11477] [Closed] NameError#qualified_name mail
  4 siblings, 0 replies; 5+ messages in thread
From: eregontp @ 2015-08-22 15:05 UTC (permalink / raw
  To: ruby-core

Issue #11477 has been updated by Benoit Daloze.


To clarify, make it so that NameError#receiver returns the receiving module in a "uninitialized constant" NameError.

----------------------------------------
Feature #11477: NameError#qualified_name
https://bugs.ruby-lang.org/issues/11477#change-53955

* Author: Yuki Nishijima
* Status: Open
* Priority: Normal
* Assignee: 
----------------------------------------
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/rails/blob/ebe73abea0ae02094ddc28f8fd60ae92373b6113/activesupport/lib/active_support/core_ext/name_error.rb#L2-L14). This will allow gems like Rails and did_you_mean to get a qualified name without parsing an error message.

```ruby
begin
  HelloWorld
rescue NameError => e
  error.name           # => :HelloWorld
  error.qualified_name # => :HelloWorld
end

begin
  String::DoesntExist
rescue NameError => e
  error.name           # => :DoesntExist
  error.qualified_name # => :"String::DoesntExist"
end
```

I'm not actually sure what it should return when the module/class is an anonymous module/class, but one thing we can do is just use the result of `#to_s`:

```ruby
m = Module.new

begin
  m::DoesntExist
rescue NameError => e
  error.name           # => :DoesntExist
  error.qualified_name # => :"#<Module:0x0000000260c2f8>::DoesntExist"
end
```

I'm open to suggestions. Let me know what you think.

Yuki



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [ruby-core:70550] [Ruby trunk - Feature #11477] NameError#qualified_name
       [not found] <redmine.issue-11477.20150822085912@ruby-lang.org>
                   ` (2 preceding siblings ...)
  2015-08-22 15:05 ` [ruby-core:70548] " eregontp
@ 2015-08-22 22:09 ` mail
  2015-11-15 11:17 ` [ruby-core:71494] [Ruby trunk - Feature #11477] [Closed] NameError#qualified_name mail
  4 siblings, 0 replies; 5+ messages in thread
From: mail @ 2015-08-22 22:09 UTC (permalink / raw
  To: 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. But in terms of the interface, I'm 👍 on `NameError#receiver` returning 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: 
----------------------------------------
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/rails/blob/ebe73abea0ae02094ddc28f8fd60ae92373b6113/activesupport/lib/active_support/core_ext/name_error.rb#L2-L14). This will allow gems like Rails and did_you_mean to get a qualified name without parsing an error message.

```ruby
begin
  HelloWorld
rescue NameError => e
  error.name           # => :HelloWorld
  error.qualified_name # => :HelloWorld
end

begin
  String::DoesntExist
rescue NameError => e
  error.name           # => :DoesntExist
  error.qualified_name # => :"String::DoesntExist"
end
```

I'm not actually sure what it should return when the module/class is an anonymous module/class, but one thing we can do is just use the result of `#to_s`:

```ruby
m = Module.new

begin
  m::DoesntExist
rescue NameError => e
  error.name           # => :DoesntExist
  error.qualified_name # => :"#<Module:0x0000000260c2f8>::DoesntExist"
end
```

I'm open to suggestions. Let me know what you think.

Yuki



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [ruby-core:71494] [Ruby trunk - Feature #11477] [Closed] NameError#qualified_name
       [not found] <redmine.issue-11477.20150822085912@ruby-lang.org>
                   ` (3 preceding siblings ...)
  2015-08-22 22:09 ` [ruby-core:70550] " mail
@ 2015-11-15 11:17 ` mail
  4 siblings, 0 replies; 5+ messages in thread
From: mail @ 2015-11-15 11:17 UTC (permalink / raw
  To: ruby-core

Issue #11477 has been updated by Yuki Nishijima.

Status changed from Open to Closed

Since #11252 is completely done and `NameError#receiver` now returns the receiving module in a "uninitialized constant" NameError, I'll close this issue.

----------------------------------------
Feature #11477: NameError#qualified_name
https://bugs.ruby-lang.org/issues/11477#change-54858

* Author: Yuki Nishijima
* Status: Closed
* Priority: Normal
* Assignee: 
----------------------------------------
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/rails/blob/ebe73abea0ae02094ddc28f8fd60ae92373b6113/activesupport/lib/active_support/core_ext/name_error.rb#L2-L14). This will allow gems like Rails and did_you_mean to get a qualified name without parsing an error message.

```ruby
begin
  HelloWorld
rescue NameError => e
  error.name           # => :HelloWorld
  error.qualified_name # => :HelloWorld
end

begin
  String::DoesntExist
rescue NameError => e
  error.name           # => :DoesntExist
  error.qualified_name # => :"String::DoesntExist"
end
```

I'm not actually sure what it should return when the module/class is an anonymous module/class, but one thing we can do is just use the result of `#to_s`:

```ruby
m = Module.new

begin
  m::DoesntExist
rescue NameError => e
  error.name           # => :DoesntExist
  error.qualified_name # => :"#<Module:0x0000000260c2f8>::DoesntExist"
end
```

I'm open to suggestions. Let me know what you think.

Yuki



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-11-15 10:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <redmine.issue-11477.20150822085912@ruby-lang.org>
2015-08-22  8:59 ` [ruby-core:70544] [Ruby trunk - Feature #11477] [Open] NameError#qualified_name mail
2015-08-22 14:21 ` [ruby-core:70546] [Ruby trunk - Feature #11477] NameError#qualified_name eregontp
2015-08-22 15:05 ` [ruby-core:70548] " eregontp
2015-08-22 22:09 ` [ruby-core:70550] " mail
2015-11-15 11:17 ` [ruby-core:71494] [Ruby trunk - Feature #11477] [Closed] NameError#qualified_name mail

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).