Do you know the purpose of semicolons in the parameter list of a proc ?
proc divmod (a, b: int; q, r: var int): void =
q = a div b
r = a mod b
Is it purely cosmetic or has it a special signification in Nimrod ?It is special:
proc p[T; S: int](a, b; c: string)
Here 'T' is unconstrained, 'S' is constrained to 'int'; 'a', 'b' have anonymous generic types and 'c' has the type string. Btw please don't use ': void'. If there is no return type, don't write a return type.
Sorry, I didn't make myself clear. My question is to know the difference between ';' and ',' in the parameter list of a proc (not the type parameters).
proc foo [T; S: string](a, b: T; c: S) =
echo "" & $a & $b & c
same as:
proc bar [T; S: string](a, b: T, c: S) =
echo "" & $a & $b & c
or
proc divmod1 (a, b: int; q, r: var int) =
q = a div b
r = a mod b
same as:
proc divmod2 (a, b: int, q, r: var int) =
q = a div b
r = a mod b
Note also that I can also use ',' in place of ';' in the type parameter list and it still compiles/works.
proc bar [T, S: string](a, b: T; c: S) =
echo "" & $a & $b & c