[#927] UnboundMethod#to_proc — Dave Thomas <dave@...>

I'm wondering what I can do with a Proc generated by

17 messages 2003/04/06

Re: problem with rb_rescue2() ?

From: matz@... (Yukihiro Matsumoto)
Date: 2003-04-19 05:04:59 UTC
List: ruby-core #974
Hi,

In message "problem with rb_rescue2() ?"
    on 03/04/19, Mathieu Bouchard <matju@sympatico.ca> writes:

|is there any way i can trap exceptions in Ruby without going through
|rb_rescue ? ... because that one is not quite convenient to use (has to go
|through another separate function and such...)

Unfortunately, no.

|well, else I make myself a struct on the stack containing receiver,
|selector, argc, argv, and i pass that to rb_rescue2() like this:
|
|rb_rescue2(
|	(RMethod)rb_rescue_funcall_2,(Ruby)&m,
|	(RMethod)rb_rescue_funcall_3,(Ruby)&m,
|	rb_eException,0);
|
|where m is the struct.
|
|Now I want to ask you how much the ruby internals are resistant to a
|non-VALUE being passed in a VALUE parameter? Especially the GC and such...
|Is that looking for trouble ? (segfault ?)

It's OK to pass non Ruby object pointer casting to VALUE.  Ruby's
conservative GC can handle them.

							matz.

In This Thread