So excited for this addition! I like to program Nim in a functional lite style, and this is some nice sugar to write functional procedures. Its also nice that the language reserved the function keyword for procedures that are _actually_ functions.
So excited for this addition! I like to program Nim in a functional lite style, and this is some nice sugar to write functional procedures. Its also nice that the language reserved the function keyword for procedures that are _actually_ functions.
I've been using it for a while in the devel version (Nim v0.18.1), and it is great — I like it very much and I completely understand your excitement!
Before I didn't bother with {.noSideEffect.} pragma, and now with `func` here — my code is much more clear (at least to me ;)), and I can immediately tell which of my procs are 'pure'.
[1]https://en.m.wikipedia.org/wiki/Side_effect_(computer_scienc...
It looks really impressive.
> If none of its parameters have the type var T or ref T or ptr T this means no locations are modified. It is a static error to mark a proc/iterator to have no side effect if the compiler cannot verify this.
I'm not sure how many compiler optimizations are possible, but I do know that procs marked with no side effect are automatically considered thread safe.