Fixed auto section

This commit is contained in:
2022-05-27 22:25:27 +02:00
parent 85ffaedcea
commit 1e8aa45176

View File

@@ -89,11 +89,12 @@ and `isub` are self explanatory.
## Auto parameters (generics, polymorphism) ## Auto parameters (generics, polymorphism)
Although I didin't specify the type of `i` in the above example, it is Although I didin't specify the type of `i` in the above example, it is
known at compile time because the recursion is applied to b which is an known at compile time because the recursion is applied to `a` which is an
integer. I could have omitted the second argument but then I would have integer. I could have omitted the second argument, then I would have
had to specify `i`'s type as an integer, because for plain lambda had to specify `i`'s type as an integer, because for plain lambda
expressions all types have to be statically knoqn at compile time. To expressions all types have to be statically known at compile time.
achieve polymorphism, one parametric tool is available, called auto
Polymorphism is achieved using parametric constructs called auto
parameters. An auto parameter is a placeholder filled in during parameters. An auto parameter is a placeholder filled in during
compilation, syntactically remarkably similar to lambda expressions: compilation, syntactically remarkably similar to lambda expressions: