From: Michal Rokos Date: 2004-06-17T15:41:26+09:00 Subject: [CVS] rb_mod_freeze??? Hello! This had been committed to CVS with """ * eval.c (rb_mod_freeze): prepare string representation before freezing. [ruby-talk:103646] """ But what should it supposed to do??? It just creates some String obj, then it's used nowhere (ret val is not even assigned anywhere, and then regular Object#freeze is called. So it's nothing else than slower Object#freeze imp? I'm sorry about this, but I started to review again what's going on in CVS. Michal Index: object.c =================================================================== RCS file: /var/cvs/src/ruby/object.c,v retrieving revision 1.152 retrieving revision 1.153 diff -u -p -u -p -r1.152 -r1.153 --- object.c 16 Jun 2004 07:04:05 -0000 1.152 +++ object.c 16 Jun 2004 14:21:33 -0000 1.153 @@ -2,8 +2,8 @@ object.c - - $Author: nobu $ - $Date: 2004/06/16 07:04:05 $ + $Author: matz $ + $Date: 2004/06/16 14:21:33 $ created at: Thu Jul 15 12:01:24 JST 1993 Copyright (C) 1993-2003 Yukihiro Matsumoto @@ -1215,6 +1215,21 @@ rb_mod_to_s(klass) /* * call-seq: + * mod.freeze + * + * Prevents further modifications to mod. + */ + +static VALUE +rb_mod_freeze(mod) + VALUE mod; +{ + rb_mod_to_s(mod); + return rb_obj_freeze(mod); +} + +/* + * call-seq: * mod === obj => true or false * * Case Equality---Returns true if anObject is an @@ -2597,6 +2612,7 @@ Init_Object() rb_define_method(rb_cSymbol, "id2name", sym_to_s, 0); rb_define_method(rb_cSymbol, "to_sym", sym_to_sym, 0); + rb_define_method(rb_cModule, "freeze", rb_mod_freeze, 0); rb_define_method(rb_cModule, "===", rb_mod_eqq, 1); rb_define_method(rb_cModule, "==", rb_obj_equal, 1); rb_define_method(rb_cModule, "<=>", rb_mod_cmp, 1);