From: Thomas Sondergaard Date: 2003-10-02T20:05:41+09:00 Subject: overload rb_protect To use rb_protect you have to wrap the function you want to protect so it accepts a single VALUE parameter. Would it not make sense to overload rb_protect, so it could protect the three normal signatures for ruby methods, ie: 1) VALUE func(VALUE self[, VALUE arg1, VALUE arg2, ...]); 2) VALUE func(int argc, VALUE *argv, VALUE self); 3) VALUE func(VALUE self, VALUE args); The existing rb_protect(VALUE (*proc)(VALUE), VALUE data, int *state) matches the third of the common signatures, so if VALUE rb_protect2(int *state, VALUE (*proc)(ANYARGS), VALUE self, ...); and VALUE rb_protect3(int *state, VALUE (*proc)(int, VALUE*, VALUE), int argc, VALUE *argv, VALUE self); were added it would be easier to do exception handling in C. Doesn't that make good sense? Or maybe rb_protect could be macroized, so you could do something like RB_EXCEPTION_INIT // declare int exception_state among other things RB_TRY ... do something that you want to protect here RB_RESCUE ... examine exception_state here Hm, okay, maybe not :-) Thomas