yarv-dev-en:36
From: Christian Neukirchen <chneukirchen gmail.com>
Date: Wed, 15 Feb 2006 18:46:46 +0100
Subject: [yarv-dev-en:36] Re: [Christian Neukirchen] Various YARV bugs
SASADA Koichi <ko1 atdot.net> writes: >> Another bug just found: >> >> #583<3|>lilith:~/src/yarv$ ./ruby -e 'a = ->(foo){ p foo }' >> BUG: unknown node (default): NODE_LAMBDA >> :0:in `initialize': compile error (SyntaxError) > > Matz decided that "->" is obsolete. ...and there was much rejoicing. ;-) >> (gdb) r foo >> Starting program: /Users/chris/src/yarv/ruby foo >> Reading symbols for shared libraries ... done >> >> Program received signal EXC_BAD_ACCESS, Could not access memory. >> frame_func_id (cfp=0x485000) at eval.c:1869 >> 1869 yarv_iseq_t *iseq = cfp->iseq; >> (gdb) bt >> #0 frame_func_id (cfp=0x485000) at eval.c:1869 >> #1 0x00002e18 in error_pos () at eval_error.h:42 >> #2 0x0000309c in error_print () at eval_error.h:108 >> #3 0x00003624 in error_handle (ex=823640) at eval_error.h:250 >> #4 0x00005a54 in ruby_options (argc=2, argv=0xbffffc38) at eval.c:175 >> #5 0x00002c58 in main (argc=2, argv=0xbffffc38, envp=0x20000000) at main.c:45 > > I can't recreate your bug. > >> # ./ruby foo.rb >> ./ruby: No such file or directory -- foo.rb (LoadError) > at my environment (on x86 linux) Here is an easy fix, I think it should not affect anything (can nd_line ever return 0 intentionally?) Index: eval_error.h =================================================================== --- eval_error.h (revision 429) +++ eval_error.h (working copy) @@ -39,13 +39,13 @@ { ruby_set_current_source(); if (ruby_sourcefile) { - if (rb_frame_callee()) { + if (ruby_sourceline == 0) { + warn_printf("%s", ruby_sourcefile); + } + else if (rb_frame_callee()) { warn_printf("%s:%d:in `%s'", ruby_sourcefile, ruby_sourceline, rb_id2name(rb_frame_callee())); } - else if (ruby_sourceline == 0) { - warn_printf("%s", ruby_sourcefile); - } else { warn_printf("%s:%d", ruby_sourcefile, ruby_sourceline); } >> Another thing, but this probably is intented for 1.9, is that [*foo] >> doesn't work for arrayification anymore. What's the best way to do it >> in 1.9? > > a = [1, 2] > p [*a] #=> [1, 2] > a = 1 > p [*a] #=> can't convert Fixnum into Array (TypeError) > > You means second error? It's new specification on Ruby 1.9. ... I have > no idea about arrayification (it's first time I see this word) with 1.9. Well, since 1.9 also drops default Object#to_a, I found no other easy way to make an object an array unless it already is one. > // SASADA Koichi at atdot dot net -- Christian Neukirchen <chneukirchen gmail.com> http://chneukirchen.org -- ML: yarv-dev-en quickml.atdot.net Info: http://www.atdot.net/~ko1/quickml
34 2006-02-15 21:56 [ko1 atdot.net ] Re: [Christian Neukirchen] Various YARV bugs -> 36 2006-02-16 02:46 ┗[chneukirchen gmail.c]