reactr icon indicating copy to clipboard operation
reactr copied to clipboard

Strongly typed Runnables

Open cohix opened this issue 4 years ago • 1 comments

Currently Runnables accept an interface{} as their Job payload. This causes issues with type coercion, and it simply a bad pattern for the long term.

I propose the concept of a Superfunc which is a 'regular Go function' that returns a Result. This user defined Superfunc would return a function whose signature is understood by Reactr. Reactr would be able to execute it like any other Runnable, and would harldly know the difference. Because the function actually being executed has references to the strongly typed input parameters, this allows for a strongly typed API (that can be codegen'd!) without needing to completely overhaul Reactr.

cohix avatar May 12 '21 00:05 cohix

This proposal is being implemented in https://github.com/suborbital/reactr/pull/81

cohix avatar May 12 '21 00:05 cohix