This code can work under 0.19.6, but fail to compile in 0.20.0 Is it a bug or some other breaking changes I need to knew?
Error: invalid type: 'KeyValuePairSeq[system.string, proc (){.gcsafe, locks: 0.}]' for var
import tables
proc test() =
echo readfile(currentSourcePath())
const
map = {
"test": test,
}.toTable
map["test"]()
Yet another {.nimcall.} magic fix.
This works:
import tables
proc test() =
echo readfile(currentSourcePath())
const
map: Table[string, proc() {.nimcall.}] = {
"test": test,
}.toTable
map["test"]()
Yet another {.nimcall.} magic fix.
Ref: https://forum.nim-lang.org/t/4665
For some reason the magic of {.nimcall.} does not work for spReadData of serial/serialstream.nim
Any advice for that case? Thanks.