I'm trying to combine a library that's necessarily threaded with one that necessarily uses shared heap. So I found [this](https://forum.nim-lang.org/t/2457#15219) suggestion to use a shared-heap GC and cast each procedure to a fake GC-safe type. Except that doesn't work and I can't find any info on why. This code produces the problem: import threadpool type BoxedInt = ref object value : int proc box(value : int) : BoxedInt = return BoxedInt(value : value) var global : BoxedInt = box 0; proc incGlobal() : int = global.value += 1 return global.value proc echoInt(i : int) : void = echo $i var thread : FlowVar[int] = spawn (cast[proc():int{.gcsafe.}](incGlobal))() awaitAndThen(thread, echoInt) Run
And get the following message: `Error: expression cannot be cast to proc (): int{.closure, gcsafe.}` So... what's going on? Is this cast-to-gcsafe business even possible at all? And what do I do if it's generally not allowed?