From: Ryan Davis Date: 2005-05-04T07:19:16+09:00 Subject: Re: I rock. On May 3, 2005, at 10:23 AM, Eric Hodel wrote: > Yup, rb_intern needs to be cached. Yup, the __self thing is wrong (it > was late, and I forgot about NODE_SELF). No, it doesn't let you > directly call C code either (yet?). ... > $ cat f.c > ... > static VALUE > rrc_cF_factorial(VALUE __self, VALUE n) { > VALUE f; > VALUE x; > f = LONG2FIX(1); > x = n; > while (RTEST(rb_funcall(x, rb_intern(">="), 1, LONG2FIX(2)))) { > f = rb_funcall(f, rb_intern("*"), 1, x); > x = rb_funcall(x, rb_intern("-"), 1, LONG2FIX(1)); > }; > return f; YAY! You do rock! And no, "__self" doesn't suck, but most of the C impl I've seen just calls it "self" straight up. This is really cool and I can't wait to read the code.