[BUG] Aliasing :lambda

Moin!

I just found this crash – it might not make much sense to make :lambda
a module_function and the code was in fact broken, but this should IMHO
be fixed anyway.

C:\dev\ruby>ruby -e “Module.new { module_function :lambda }”
-e:1: [BUG] undefined method `lambda’; can’t happen
ruby 1.8.1 (2004-01-27) [i386-mswin32]

This application has requested the Runtime to terminate it in an unusual
way.
Please contact the application’s support team for more information.

···

Module.new { module_function :lambda }
-:1: [BUG] undefined method `lambda’; can’t happen
ruby 1.8.0 (2003-08-04) [i686-linux]


I send this to both comp.lang.ruby and matz, because the gateway seems
to be quite instable at the moment. I hope this message doesn’t get lost
in total nirvana.

Regards,
Florian Gross

D’uh, the topic should be “[BUG] module_functioning :lambda”.

Hi,

At Sun, 29 Feb 2004 05:54:47 +0900,
Florian Gross wrote in [ruby-talk:93919]:

I just found this crash – it might not make much sense to make :lambda
a module_function and the code was in fact broken, but this should IMHO
be fixed anyway.

C:\dev\ruby>ruby -e “Module.new { module_function :lambda }”
-e:1: [BUG] undefined method `lambda’; can’t happen
ruby 1.8.1 (2004-01-27) [i386-mswin32]

Thank you for the report.

Index: eval.c

···

===================================================================
RCS file: /cvs/ruby/src/ruby/eval.c,v
retrieving revision 1.639
diff -u -2 -p -r1.639 eval.c
— eval.c 27 Feb 2004 13:29:56 -0000 1.639
+++ eval.c 29 Feb 2004 10:18:51 -0000
@@ -6987,6 +6987,6 @@ rb_mod_modfunc(argc, argv, module)
}

  • secure_visibility(module);
    if (argc == 0) {
  • secure_visibility(module);
    SCOPE_SET(SCOPE_MODFUNC);
    return module;
    @@ -7000,4 +7000,8 @@ rb_mod_modfunc(argc, argv, module)
    for (;:wink: {
    body = search_method(m, id, &m);
  •   m = RCLASS(m)->super;
    
  •   if (!body && !m) {
    
  •   body = search_method(rb_cObject, id, 0);
    
  •   }
      if (body == 0 || body->nd_body == 0) {
      rb_bug("undefined method `%s'; can't happen", rb_id2name(id));
    

@@ -7006,5 +7010,4 @@ rb_mod_modfunc(argc, argv, module)
break; /* normal case: need not to follow ‘super’ link */
}

  •   m = RCLASS(m)->super;
      if (!m) break;
    
    }


Nobu Nakada