Hi!
What am I doing wrong here:
type
FooProc = proc(x: int)
Callbacks = tuple [
cb: FooProc
]
proc foo(x: int) : void = echo "foo: " & $x
let f:FooProc = foo
let c0: Callbacks = (cb: f) # works fine
let c1: Callbacks = (cb: foo) # type mismatch!
c0.cb(42)
c1.cb(42)
The assignment to c1 complains, saying:
: type mismatch: got (tuple[cb: proc (x: int){.gcsafe, locks: 0.}]) but
expected 'Callbacks = tuple[cb: FooProc]'
But surely f and foo are the same? Shouldn't that assignment either always
fail, or always be OK? What am I missing?
Thanks!