Merge pull request #2885 from apense/patch-4
Note about deprecation in generics.txt
This commit is contained in:
commit
60bc1fd7ba
1 changed files with 4 additions and 2 deletions
|
|
@ -164,11 +164,13 @@ Alternatively, the ``distinct`` type modifier can be applied to the type class
|
||||||
to allow each param matching the type class to bind to a different type.
|
to allow each param matching the type class to bind to a different type.
|
||||||
|
|
||||||
If a proc param doesn't have a type specified, Nim will use the
|
If a proc param doesn't have a type specified, Nim will use the
|
||||||
``distinct auto`` type class (also known as ``any``):
|
``distinct auto`` type class (also known as ``any``). Note this behavior is
|
||||||
|
deprecated for procs; templates, however, support them:
|
||||||
|
|
||||||
.. code-block:: nim
|
.. code-block:: nim
|
||||||
# allow any combination of param types
|
# allow any combination of param types
|
||||||
proc concat(a, b): string = $a & $b
|
proc concat(a, b): string = $a & $b # deprecated
|
||||||
|
proc concat(a, b: any): string = $a & $b # preferred
|
||||||
|
|
||||||
Procs written with the implicitly generic style will often need to refer to the
|
Procs written with the implicitly generic style will often need to refer to the
|
||||||
type parameters of the matched generic type. They can be easily accessed using
|
type parameters of the matched generic type. They can be easily accessed using
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue