mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 09:51:04 +01:00
@@ -161,7 +161,7 @@ in cases that inheritance struggles with.
|
||||
|
||||
### Use cases
|
||||
|
||||
To clarify the expressive range we are aming for, here are some specific use
|
||||
To clarify the expressive range we are aiming for, here are some specific use
|
||||
cases we expect Carbon generics to cover.
|
||||
|
||||
#### Generic programming
|
||||
|
||||
@@ -69,7 +69,7 @@ a single one.
|
||||
|
||||
## Generic versus template parameters
|
||||
|
||||
When we are distinguishing between generics and templates in Carbon, it is on an
|
||||
When we are distinguishing between generics and templates in Carbon, it is on a
|
||||
parameter by parameter basis. A single function can take a mix of regular,
|
||||
generic, and template parameters.
|
||||
|
||||
@@ -195,7 +195,7 @@ fn F[template T:! Type](x: T*) -> T;
|
||||
fn F(x: Int) -> bool;
|
||||
```
|
||||
|
||||
A generic function `G` can call `F` with a type like `T*` that can not possibly
|
||||
A generic function `G` can call `F` with a type like `T*` that cannot possibly
|
||||
call the `F(Int)` overload for `F`, and so it can consistently determine the
|
||||
return type of `F`. But `G` can't call `F` with an argument that could match
|
||||
either overload.
|
||||
@@ -267,7 +267,7 @@ complete definition checking. This occurs for
|
||||
|
||||
## Deduced parameter
|
||||
|
||||
An deduced parameter is listed in the optional `[` `]` section right after the
|
||||
A deduced parameter is listed in the optional `[` `]` section right after the
|
||||
function name in a function signature:
|
||||
|
||||
`fn` <name> `[` <deduced parameters> `](` <explicit parameters `) ->`
|
||||
|
||||
Reference in New Issue
Block a user