Nim usually uses proc to define functions

Terry: why is the nim docs using "func" instead of "proc" ?

Clyde: It's basically proc with extra macros: {.noSideEffect, locks: 0.}

Terry: so when do I want to use func?

George: When you don't have any side-effects

Janus: proc -> used when you explicitly want side effects

func -> used when you explicitly dont want side effects

Terry: what do you mean by side effects?

like changing global state?

Janus: yes

Terry: haven't seen that distinction in other languages

but i guess it makes sense

does it warn you if you don't use it properly?

Janus: it fails to compile

only if you use func

Phil: !eval var global = "foo"; func bad() = global.add("hello"); bad()

Compile failed: /usercode/in.nim(1, 26) Error: 'bad' can have side effects

Janus: explicit var parameters are not counted as side effects,

which is a departure from the mathematical meaning

so if you want "real" no-side-effect guarantees,

dont use var params and use strict functions