Is it recommended to use void "type" for procs that do not return a value? (for the sake of explicitness)
proc say(this: string): void =
echo this
vs
proc say(this: string) =
echo this
If not, what would be a use case for void?
Some people like to explicitly specify all their types, despite Nim's type inference, but I've never seen anyone explicitly specifying a void return type. If it doesn't disbiguate it's just noise.
The void type is used internally of course but it's rare you'd need to use it in practice. One counterexample: declaring the type of a procvar when using sugar:
import sugar
var x:(string)->void
x = say
Is it recommended to use void "type" for procs that do not return a value? (for the sake of explicitness)
No, idiomatic Nim simply omits the return type part.
The biggest usage for void is in generics, for example
type
Future[T] = object
# Hold a value that might be available in the future.
finished: bool
val: T
proc read(f: File): Future[string] = discard
## Read a string from file asynchronously.
proc wait(ms: int): Future[void] = discard
## Wait asynchronously.
Here void is used to signify a lack of value.