Sam Ruby wrote:

I have a number of cases (filter, map, reduce), where I am passed an arbirary sub and need to call it. I should not have to know how the sub is implemented.

I'd a look at map and friends now. You are running code that has a signature of "PP". You'd need additionally:


  if (func->vtable->base_type == enum_class_NCI) {
     typedef PMC* (*func_pp)(Interp*, PMC*);
     func_pp cfunc = (func_pp) D2FPTR(PMC_struct_val(func));
     item = (cfunc)(interpreter, item);
  }
  else { ...

You could of course add a general "call_PP" wrapper that handles both cases. But as you did already replace the general runops_args with a hand-crafted call setup, adding above lines should do it.

leo



Reply via email to