Re: Function as object? Object as function?

2018-04-08 Thread mjendrusch
This has to be recent then, both the above snippets do not produce that deprecation warning on Nim 0.18.0 at play.nim-lang.org in the presence of pragma experimental, while producing exactly that warning without experimental. I'll check it again on devel when I get back to my machine. It seems i

Re: Function as object? Object as function?

2018-04-08 Thread mjendrusch
Did you add the {.experimental.} pragma? That should remove the deprecation warning, as that warning happens because () is experimental.

Re: Function as object? Object as function?

2018-04-08 Thread mjendrusch
You can get this behaviour by overloading the experimental () operator on an object type, like so: {. experimental .} import math type Callable = object val: int # Make the thing callable. Needs {. experimental .} proc `()`(c: Callable; i: