This project is read-only.

How to cast/wrap scheme procedures to delegate types?

Nov 27, 2011 at 9:51 PM


I tried to use ironscheme threading and after a call to make-thread I got the error:

Unhandled CLR exception during evaluation:
CLR Exception: System.ArgumentException
System.ArgumentException: The type or method has 1 generic parameter(s), but 0 g
eneric argument(s) were provided. A generic argument must be provided for each g
eneric parameter.
   at System.RuntimeType.SanityCheckGenericArguments(RuntimeType[] genericArgume
nts, RuntimeType[] genericParamters)
   at System.Reflection.RuntimeMethodInfo.MakeGenericMethod(Type[] methodInstant
   at IronScheme.Runtime.Helpers.MakeVoidTypedCallable(Type[] argtypes, Callable
   at IronScheme.Runtime.Helpers.ConvertToDelegate[T](Object proc)
   at threading.ironscheme.threading::make-thread(Object proc)
   at #.ironscheme.exceptions::dynamic-wind(Object in, Object proc, Object out)
   at #.ironscheme.exceptions::dynamic-wind(Object in, Object proc, Object out)
   at IronScheme.Runtime.Builtins.CallWithCurrentContinuation(Object fc1)
   at IronScheme.Runtime.R6RS.Exceptions.WithClrExceptionHandler(Object handler,
 Object thunk)

I tried to map another method using a delegate as a parameter and I get the same error.

So I am wondering how to cast/wrap scheme procedures to delegate types?



Nov 28, 2011 at 4:57 AM


Show some Scheme code please.

Procedures should automatically convert given you have the correct number of arguments.

IIRC ThreadStart delegate has none, so you need to provide a thunk. Eg

(lambda () ... )



Nov 28, 2011 at 5:05 AM

Hi again

Just ran a small test. Seems a bug have crept in somewhere, getting same error :(

Will fix ASAP :)



Nov 28, 2011 at 5:05 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Nov 28, 2011 at 5:14 AM

I have fixed it the bug locally and will push the fixes tonite. See bug item for solution if needed now.