Hi, I'm trying to proc types based on the proc's input/output types, but I can't quite make it work without converting types.
My problem boils down to the following:
import sugar
echo ((x: int) => true) is (int -> bool) # => false, WAT?
Take a look at the playground.
How come this is false?
Now, if I define the very same procedure in a typed context, the test holds true!
import sugar
func f: int -> bool =
(x: int) => true
echo f() is (int -> bool) # => true, WAAT?
It seems that is is sensitive to the calling mechanism. This prints true:
import sugar
echo (proc (x: int): bool {.closure.} = true) is (int -> bool)