Re: instance_eval, yield, C extensions



Daniel Berger wrote:
Tilman Sauerbeck wrote:
ruby to expect zero arguments. So make that 0 a 1.


static VALUE kernel_foo(VALUE self){
VALUE v_proc = rb_proc_new(foo_block, self); /* Also tried Qnil */
return rb_funcall(rb_cObject, rb_intern("instance_eval"), 0, v_proc);

Some problem here.

HTH,
Tilman

Ok, fixing that I get "can't convert Proc into String (TypeError)".

Right now that code is equivalent to

obj.instance_eval block

Where it should be

obj.instance_eval &block
obj.instance_eval {some_code}
obj.instance_eval 'some_code'

Maybe I'm supposed to be using rb_block_proc, but I'm not entirely
certain how
it works.

Thanks,

Dan


--
Posted via http://www.ruby-forum.com/.

.



Relevant Pages

  • :) Contest: fast way to chop string in short fixed pieces.
    ... I am searching for _the_ tcl way to chop a given string into short ... chunks of a fixed length. ... If You don't know Your parameters beforehand, ... proc chop_string { ...
    (comp.lang.tcl)
  • Re: pass large blocks of data
    ...    I am trying to pass a large string  to a proc as an arg. ... when I see this arg value inside ... the proc, it was sliced and only 64 characters were there in the arg. ... I think it is due to the limitation of bash. ...
    (comp.lang.tcl)
  • Re: pass large blocks of data
    ...    I am trying to pass a large string  to a proc as an arg. ... of length more than 90 chars. ... when I see this arg value inside ... the proc, it was sliced and only 64 characters were there in the arg. ...
    (comp.lang.tcl)
  • Re: quick print type debugging
    ... putting code in a string (editors treat it like a string rather ... You get it all with d2, but you have the inefficiency of eval ... later down the road we get the ability to convert a Proc back ... Mail has the best spam protection around ...
    (comp.lang.ruby)
  • Help needed: Dynamically create a Proc from a String and evaluate it
    ... I need help in dynamically creating a Proc from a String like, say, ... GMX FreeMail: 1 GB Postfach, 5 E-Mail-Adressen, 10 Free SMS. ...
    (comp.lang.ruby)

Loading