我有以下 Nim 程序:
import threadpool
var channel: TChannel[string]
proc consumer(channel: TChannel[string]) =
let (flag,msg) = tryRecv(channel)
if flag:
echo msg
channel.open()
spawn consumer(channel)
channel.send("hello")
channel.close()
sync()
当我尝试编译它时,它给了我这个错误消息:
testchannels.nim(6, 27) Error: type mismatch: got (TChannel[system.string])
but expected one of:
system.tryRecv(c: var TChannel[tryRecv.TMsg])
我不明白错误消息试图告诉我什么......