Issue #8839 has been updated by Yuki Nishijima.


I find myself repeating writing something like below (which, of course, doesn't work at this moment):

```ruby
private_constant class Person
  ...
end
```

It would be great if we could do the above. It would need to return a symbol, not a class, though. 

----------------------------------------
Feature #8839: Class and module should return the class or module that was opened
https://bugs.ruby-lang.org/issues/8839#change-55812

* Author: Charles Nutter
* Status: Assigned
* Priority: Normal
* Assignee: Yukihiro Matsumoto
----------------------------------------
With the change for https://bugs.ruby-lang.org/issues/3753, "def" forms now return the symbolic name of the method defined. Because class and module bodies just return the last expression in their bodies, this means they will now usually end up returning a symbol for the last method defined. This does not seem useful or correct.

I think class and module should return a reference to the class or module just opened. This would make the return value useful and consistent.



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

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>