From: "jballanc (Joshua Ballanco)" Date: 2013-11-07T17:34:47+09:00 Subject: [ruby-core:58213] [ruby-trunk - Feature #8839] Class and module should return the class or module that was opened Issue #8839 has been updated by jballanc (Joshua Ballanco). =begin Just to throw my 2�� in... I think the main benefit to returning a symbol from (({def})) is that it enables the use of method decorators. Similarly, I would be in favor of returning the class defined from (({class})) so that we could also build class decorators. A trivial example: def enumerable(klass) klass.send(:include, Enumerable) klass end enumerable class Foo #... end =end ---------------------------------------- Feature #8839: Class and module should return the class or module that was opened https://bugs.ruby-lang.org/issues/8839#change-42795 Author: headius (Charles Nutter) Status: Assigned Priority: Normal Assignee: matz (Yukihiro Matsumoto) Category: Target version: next minor 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. -- http://bugs.ruby-lang.org/