From: "mame (Yusuke Endoh)" Date: 2012-04-23T23:55:53+09:00 Subject: [ruby-core:44557] [ruby-trunk - Feature #5148][Rejected] Constant Namespace/Scoping in Dynamic Classes/Modules Issue #5148 has been updated by mame (Yusuke Endoh). Status changed from Assigned to Rejected Assignee deleted (mame (Yusuke Endoh)) Okay. Thomas, or anyone interested, please create a patch yourself, experiment it, show an objective evaluation of the influence of this feature, and then, persuade matz again. -- Yusuke Endoh ---------------------------------------- Feature #5148: Constant Namespace/Scoping in Dynamic Classes/Modules https://bugs.ruby-lang.org/issues/5148#change-26112 Author: trans (Thomas Sawyer) Status: Rejected Priority: Normal Assignee: Category: Target version: When defining a dynamic class or module, the constants defined within it are not kept within it's namespace, but are tied to the outer scope's namespace. c = Class.new do module M; end end #=> # c::M #=> M M #=> M This presents serious limitations in designing domain specific languages that take advantage of Ruby's class system. For instance in creating a test framework that uses blocks to defines testcases it is not possible to isolate fixture constants from those of other testcases. E.g. describe "fancy mixin" do class Foo include FancyMixin end ... end describe "unfancy mixin" do class Foo include UnfancyMixin end ... end Foo in the unfancy testcase will use Foo in the fancy testcase, causing unexpected issues --especially as these testcases may be defined in different files and coded by different people. -- http://bugs.ruby-lang.org/