From: Trans Date: 2005-10-20T11:16:58+09:00 Subject: Re: Cut-based AOP |Thanks. I do feel pretty strongly about my first point (classes are |instantiable) and I think it really comes down to that on the Module side |versus cuts being part of the class inheritance heirarchy on the other. And |the nature of cut inheritance does separate it from the class heirarchy. On the other hand cuts are in essence classes --transparent *subclasses* to be exact. While you do not instantiate them directly, they get instantiated as part of the class they cut. I think the real incongruency comes more from the fact that Class itself is a subclass of Module. It works okay, but conceptualy it is odd. And on occasion you have undef a method in Class that's been defined in Module. I think Matz even metions something liek this in his recent presentation. It think a better solution would come from having a "ClassKernel" module which is included in Module and Class, so they can stand on their own. Finally, I think cuts are simliar to singleton_classes in that instantiating them is restricted. o = Object.new => # irb(main):002:0> eigenclass = class << o; self ; end => #> irb(main):003:0> k = eigenclass.new TypeError: can't create instance of virtual class from (irb):3:in `new' from (irb):3 But I don't think there's any techincal reason they could not be. It's purposefully disallowed, I guess for conceptual reasons: VALUE rb_class_new(super) VALUE super; { Check_Type(super, T_CLASS); if (super == rb_cClass) { rb_raise(rb_eTypeError, "can't make subclass of Class"); } if (FL_TEST(super, FL_SINGLETON)) { rb_raise(rb_eTypeError, "can't make subclass of virtual class"); } return rb_class_boot(super); } Hey, this still says "virtual class"; _why doesn't his say eigenclass!? ;) T.