I'm implementing an event system, but currently I'm stuck.
To illustrate my problem, I wrote this example:
proc greet(msg: string) =
echo msg
proc someotherproc() =
echo "Hallo Welt"
let procedures: seq[the_type_im_searching_for] = @[]
procedures.add(some_cast(greet))
procedures.add(some_cast(someotherproc))
cast_back(procedures[0])("Hallo Welt")
cast_back(procedures[1])()
I'm searching for the_type_im_searching_for and some_cast and cast_back. Simply
using cast[int](greet) or cast[proc()](greet) and
cast[proc(msg:string)](uniformtype) doesn't work.
I know this is unsafe but the whole mechanic will be hidden.