From: matz@... (Yukihiro Matsumoto) Date: 2000-09-25T18:15:54+09:00 Subject: [ruby-talk:5099] Re: binding weirdness Hi, In message "[ruby-talk:5093] binding weirdness" on 00/09/25, "Brian F. Feldman" writes: |I notice that (using 1.6.0 and 1.6.1 snapshot; finding some other kinda |strange problems, too...) binding acts very strangely with regard to |defining a method after it has been previously accessed with an error. I think it's caused by method cache inconsistency. Try the following patch, please. --- eval.c 2000/09/22 18:15:41 1.109 +++ eval.c 2000/09/25 09:14:42 @@ -240,2 +240,3 @@ st_insert(RCLASS(klass)->m_tbl, mid, body); + rb_clear_cache_by_id(mid); } @@ -360,3 +361,2 @@ else { - rb_clear_cache_by_id(mid); rb_add_method(klass, mid, 0, NOEX_UNDEF); @@ -410,3 +410,2 @@ else { - rb_clear_cache_by_id(name); rb_add_method(klass, name, NEW_ZSUPER(), noex); @@ -1497,3 +1496,2 @@ rb_add_method(klass, id, 0, NOEX_PUBLIC); - rb_clear_cache_by_id(id); } @@ -2827,3 +2825,2 @@ } - rb_clear_cache_by_id(node->nd_mid); if (node->nd_noex) { /* toplevel */ @@ -2893,3 +2890,2 @@ } - rb_clear_cache_by_id(node->nd_mid); rb_add_method(klass, node->nd_mid, node->nd_defn, @@ -5042,4 +5038,4 @@ } - len = strlen(feature); - if (strncmp(f, feature, len) == 0) { + len = strlen(f); + if (strncmp(f, feature, strlen(feature)) == 0) { if (strcmp(f+len, ".so") == 0) { @@ -5350,3 +5346,2 @@ } - rb_clear_cache_by_id(id); rb_add_method(rb_singleton_class(module), id, body->nd_body, NOEX_PUBLIC);