From: "Paul E.C. Melis" Date: 2002-10-17T19:46:45+09:00 Subject: Multiple constructors in a .c extension? Hello, I was wondering if it is wise/common practice/allowed to have multiple constructors for a class defined in a C extension. Specifically, I'm currently doing the following in my extension: rb_define_singleton_method(c..., "new", t_new, 1); rb_define_singleton_method(c..., "new_from_file", t_new_from_file, 1); With both calls a structure is allocated and wrapped with Data_Wrap_Struct(), followed by rb_obj_call_init() on the created object. The idea of course is to be able to say obj1 = MyClass.new(...) and obj2 = MyClass.new_from_file('some_file') in my script. The defined initialize method in the extension actually does nothing, so I would rather leave it out. I don't see any reason myself why object construction and initialization can't be done completely by the C functions implementing new and new_from_file. Is there anything special about the "new" singleton method other than that it implicitly calls "initialize"? Thanks, Paul