Auto type

The auto type can only be used for return types and parameters. For return types it causes the compiler to infer the type from the routine body:

  1. proc returnsInt(): auto = 1984

For parameters it currently creates implicitly generic routines:

  1. proc foo(a, b: auto) = discard

Is the same as:

  1. proc foo[T1, T2](a: T1, b: T2) = discard

However later versions of the language might change this to mean “infer the parameters’ types from the body”. Then the above foo would be rejected as the parameters’ types can not be inferred from an empty discard statement.