From: Vicente Bosch Campos Date: 2011-03-26T23:38:49+09:00 Subject: Re: Dynamic classes I understand how it works at the moment. Still if you are doing metaprogramming and consider with a very purist perspective that everything is an object then a Class definition is just an instance of the Class Class and I should be able to change its properties and that should be independent of having the definition assigned to a variable otherwise it would be discarded as you say. Did a bit of reading and at the end you can also create a class in the following manner which allows you to define a name dynamically with out using eval: Object.const_set("Bar",Class.new) This is due (from my opinion) to how the vm stores the classes as constants in Object. I understand why but I think there should be a more cleaner,abstract way to create Class definitions as they are objects instead of the current Bare metal approach ( we get to see to much of the internals ?) On Mar 26, 2011, at 12:09 AM, 7stud -- wrote: > Vicente Bosch Campos wrote in post #989219: >> I wonder why Class.new and Module.new don't have a parameter to define >> the name (seems something a person would want to do). Any ideas ? >> > > Because you have to assign the newly created class to a > variable--otherwise it will be discarded--just like all values that > aren't assigned to a variable. If you want to name the class, you > assign the newly created class to a constant, i.e. a name that is > capitalized. > > -- > Posted via http://www.ruby-forum.com/. >