deprecate any (redundant with auto) (original) (raw)
https://nim-lang.github.io/Nim/manual.html claims:
any | distinct auto (see below)
but then doesn't show examples with any.
And in fact this seems incorrect:
when true: proc main1(a, b: any)=discard proc main2(a, b: auto)=discard main1(1,"x") # works main2(1,"x") # works
so any seems redundant with auto, unless I'm missing something.
(docs also mention this: https://nim-lang.github.io/Nim/manual.html#templates-symbol-binding-in-templates
For parameters it currently creates implicitly generic routines:
proc foo(a, b: auto) = discard
Is the same as:
proc foo[T1, T2](a: T1, b: T2) = discard
it's also not used (much/at all) IIRC and is underdocumented.
note
docs also says:
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.
but IMO a pragma should be used for that instead of changing meaning of auto
note 2
docs should add right here:typedesc is a "bind many" type class:
that auto is also "bind many"